haikuwebkit/Source/WebCore/svg/SVGTransformValue.h

293 lines
8.9 KiB
C
Raw Permalink Normal View History

[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
/*
* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
* Copyright (C) 2019 Apple Inc. All rights reserved.
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#pragma once
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
#include "FloatConversion.h"
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
#include "FloatPoint.h"
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
#include "FloatSize.h"
#include "SVGMatrix.h"
#include <wtf/NeverDestroyed.h>
#include <wtf/text/StringBuilder.h>
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
namespace WebCore {
class FloatSize;
class SVGTransformValue {
public:
enum SVGTransformType {
SVG_TRANSFORM_UNKNOWN = 0,
SVG_TRANSFORM_MATRIX = 1,
SVG_TRANSFORM_TRANSLATE = 2,
SVG_TRANSFORM_SCALE = 3,
SVG_TRANSFORM_ROTATE = 4,
SVG_TRANSFORM_SKEWX = 5,
SVG_TRANSFORM_SKEWY = 6
};
enum ConstructionMode {
ConstructIdentityTransform,
ConstructZeroTransform
};
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
SVGTransformValue(SVGTransformType type = SVG_TRANSFORM_MATRIX, const AffineTransform& transform = { })
: m_type(type)
, m_matrix(SVGMatrix::create(transform))
{
}
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
SVGTransformValue(const SVGTransformValue& other)
: m_type(other.m_type)
, m_matrix(SVGMatrix::create(other.matrix()->value()))
, m_angle(other.m_angle)
, m_rotationCenter(other.m_rotationCenter)
{
}
SVGTransformValue(SVGTransformType type, Ref<SVGMatrix>&& matrix, float angle, const FloatPoint& rotationCenter)
: m_type(type)
, m_matrix(WTFMove(matrix))
, m_angle(angle)
, m_rotationCenter(rotationCenter)
{
}
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
SVGTransformValue(SVGTransformValue&& other)
: m_type(other.m_type)
, m_matrix(other.m_matrix.copyRef())
, m_angle(other.m_angle)
, m_rotationCenter(other.m_rotationCenter)
{
}
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
SVGTransformValue& operator=(const SVGTransformValue& other)
{
m_type = other.m_type;
m_matrix->setValue(other.m_matrix->value());
m_angle = other.m_angle;
m_rotationCenter = other.m_rotationCenter;
return *this;
}
SVGTransformType type() const { return m_type; }
const Ref<SVGMatrix>& matrix() const { return m_matrix; }
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
float angle() const { return m_angle; }
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
FloatPoint rotationCenter() const { return m_rotationCenter; }
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
bool isValid() const { return m_type != SVG_TRANSFORM_UNKNOWN; }
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
void setMatrix(const AffineTransform& matrix)
{
m_type = SVG_TRANSFORM_MATRIX;
m_angle = 0;
m_rotationCenter = FloatPoint();
m_matrix->setValue(matrix);
}
void matrixDidChange()
{
// The underlying matrix has been changed, alter the transformation type.
// Spec: In case the matrix object is changed directly (i.e., without using the methods on the SVGTransform interface itself)
// then the type of the SVGTransform changes to SVG_TRANSFORM_MATRIX.
m_type = SVG_TRANSFORM_MATRIX;
m_angle = 0;
m_rotationCenter = FloatPoint();
}
FloatPoint translate() const
{
return FloatPoint::narrowPrecision(m_matrix->e(), m_matrix->f());
}
void setTranslate(float tx, float ty)
{
m_type = SVG_TRANSFORM_TRANSLATE;
m_angle = 0;
m_rotationCenter = FloatPoint();
m_matrix->value().makeIdentity();
m_matrix->value().translate(tx, ty);
}
FloatSize scale() const
{
return FloatSize::narrowPrecision(m_matrix->a(), m_matrix->d());
}
void setScale(float sx, float sy)
{
m_type = SVG_TRANSFORM_SCALE;
m_angle = 0;
m_rotationCenter = FloatPoint();
m_matrix->value().makeIdentity();
m_matrix->value().scaleNonUniform(sx, sy);
}
void setRotate(float angle, float cx, float cy)
{
m_type = SVG_TRANSFORM_ROTATE;
m_angle = angle;
m_rotationCenter = FloatPoint(cx, cy);
// TODO: toString() implementation, which can show cx, cy (need to be stored?)
m_matrix->value().makeIdentity();
m_matrix->value().translate(cx, cy);
m_matrix->value().rotate(angle);
m_matrix->value().translate(-cx, -cy);
}
void setSkewX(float angle)
{
m_type = SVG_TRANSFORM_SKEWX;
m_angle = angle;
m_rotationCenter = FloatPoint();
m_matrix->value().makeIdentity();
m_matrix->value().skewX(angle);
}
void setSkewY(float angle)
{
m_type = SVG_TRANSFORM_SKEWY;
m_angle = angle;
m_rotationCenter = FloatPoint();
m_matrix->value().makeIdentity();
m_matrix->value().skewY(angle);
}
String valueAsString() const
{
StringBuilder builder;
builder.append(prefixForTransfromType(m_type));
switch (m_type) {
case SVG_TRANSFORM_UNKNOWN:
break;
case SVG_TRANSFORM_MATRIX:
appendMatrix(builder);
break;
case SVG_TRANSFORM_TRANSLATE:
appendTranslate(builder);
break;
case SVG_TRANSFORM_SCALE:
appendScale(builder);
break;
case SVG_TRANSFORM_ROTATE:
appendRotate(builder);
break;
case SVG_TRANSFORM_SKEWX:
appendSkewX(builder);
break;
case SVG_TRANSFORM_SKEWY:
appendSkewY(builder);
break;
}
return builder.toString();
}
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
static const char* prefixForTransfromType(SVGTransformType type)
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
{
switch (type) {
case SVG_TRANSFORM_UNKNOWN:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
case SVG_TRANSFORM_MATRIX:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "matrix(";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
case SVG_TRANSFORM_TRANSLATE:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "translate(";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
case SVG_TRANSFORM_SCALE:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "scale(";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
case SVG_TRANSFORM_ROTATE:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "rotate(";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
case SVG_TRANSFORM_SKEWX:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "skewX(";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
case SVG_TRANSFORM_SKEWY:
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "skewY(";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
ASSERT_NOT_REACHED();
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
return "";
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
private:
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
static void appendFixedPrecisionNumbers(StringBuilder& builder)
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
{
builder.append(')');
}
template<typename Number, typename... Numbers>
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
static void appendFixedPrecisionNumbers(StringBuilder& builder, Number number, Numbers... numbers)
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
{
if (builder.length() && builder[builder.length() - 1] != '(')
builder.append(' ');
Use even more "shortest form" formatting, and less "fixed precision" and "fixed width" https://bugs.webkit.org/show_bug.cgi?id=198918 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): Rewrote the string creation code to use makeString instead of StringBuilder and no longer use any fixed precision. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Dump doubles with shortest form instead of fixed precision. Source/WebCore: The places left untouched are the ones where changing behavior has some kind of unwanted observable effect for one of two reasons. Otherwise, switched almost all call sites. 1) Substantial number of test results that depend on the current behavior. 2) Poor rounding resulting in conversion from float to double and back (or similar) that results in values with tiny fractional residue like "6.000001". * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::changeValueByStep): Use shortest instead of fixed. (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto. * css/CSSAspectRatioValue.cpp: (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): Ditto. Also use makeString instead of StringBuilder for better efficiency. * css/CSSGradientValue.cpp: (WebCore::appendGradientStops): Ditto. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::keyText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto. * css/MediaQueryEvaluator.cpp: (WebCore::aspectRatioValueAsString): Ditto. * css/TransformFunctions.h: Removed unnneeded forward declarations. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize const): Use shortest instead of fixed. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto. * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Use shortest instead of fixed. Also wrote a FIXME abot this strange code that uses "calc()" to do math on two numbers, math that could instead be done by the code converting the numbers to a style string. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::drawRulers): Use shortest instead of fixed. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto. * page/scrolling/AxisScrollSnapOffsets.cpp: (WebCore::snapOffsetsToString): Ditto. (WebCore::snapOffsetRangesToString): Ditto. (WebCore::snapPortOrAreaToString): Ditto. * platform/graphics/Color.cpp: (WebCore::decimalDigit): Added. (WebCore::serializedFractionDigitsForFractionalAlphaValue): Added. (WebCore::Color::cssText const): Rewrote to generate the same results using makeString rather than StringBuilder, and integer math rather than converting from integer to floating point and then doing floating point math. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText const): Use shortest instead of fixed. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. * svg/SVGAngleValue.cpp: (WebCore::SVGAngleValue::valueAsString const): Ditto. * svg/SVGLengthList.h: Added now-needed include of StringBuilder.h. * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::valueAsString const): Use shortest instead of fixed. * svg/SVGNumberList.h: Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::appendFlag): Use multiple-argument append for better efficiency. (WebCore::appendNumber): Added a comment about why we can't yet convert this to use shortest instead of fixed: code that parses floats but then creates a CG path that stores things as double and does math as double then converts back to float results in float values that didn't round trip well and have fractions. This is smoothed away (hidden) by using fixed precision to conver them to strings. (WebCore::appendPoint): Call appendNumber to cut down on repeated code. * svg/SVGPointList.h: Use shortest instead of fixed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::prefixForTransfromType): Return a string literal instead of a WTF::String to avoid creating and destroying an object each time. (WebCore::SVGTransformValue::appendFixedPrecisionNumbers): Added a comment explaining why we need to continue to use fixed precision here. Same issue with CGAffineTransform using double as we have with CGPath above. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<float>::toString): Use shortest instead of fixed. (WebCore::SVGPropertyTraits<FloatPoint>::toString): Ditto. (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto. * testing/Internals.cpp: (WebCore::Internals::dumpMarkerRects): Added a comment explaining why we have to use fixed precision here. There are many test results that we would need to update. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::getCurrentCursorInfo): Use shortest instead of fixed. * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): Ditto. Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): Use shortest instead of fixed. Also use makeString instead of StringBuilder. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): Use shortest instead of fixed. Also use multiple-argument append on StringBuilder to make the function shorter and easier to read. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Ditto. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog): Use shortest instead of fixed. Source/WTF: * wtf/Logger.h: (WTF::LogArgument::toString): Log floating point numbers as shortest form instead of fixed precision. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Convert time to string as shortest form instead of fixed precision. Also use multiple-argument append for great simplicity and clarity. LayoutTests: * platform/mac/svg/dom/length-list-parser-expected.png: Removed. Not sure how many other pixel results we have like this, but this included an ancient style Aqua scrollbar so hasn't matched anything for years and would clearly not have any value for regression testing. * svg/dom/length-list-parser-expected.txt: Updated to expect logging of a 7 digit length as an integer rather than rounded as "d.ddddd+6". Canonical link: https://commits.webkit.org/219329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-14 17:16:03 +00:00
// FIXME: Shortest form would be better, but fixed precision is required for now to smooth over precision errors caused by converting float to double and back since we use AffineTransform to store transforms.
Simplify StringBuilder API/align with makeString by removing appendFixed* functions and using FormatNumber struct instead https://bugs.webkit.org/show_bug.cgi?id=205671 Reviewed by Alex Christensen. Source/JavaScriptCore: * API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)). Source/WebCore: * css/CSSFontVariationValue.cpp: * css/CSSKeyframeRule.cpp: * css/CSSTimingFunctionValue.cpp: * css/parser/CSSParserToken.cpp: * html/HTMLImageElement.cpp: * page/scrolling/AxisScrollSnapOffsets.cpp: * platform/graphics/Color.cpp: * platform/graphics/ExtendedColor.cpp: * platform/graphics/ca/win/PlatformCALayerWin.cpp: * platform/graphics/freetype/FontCacheFreeType.cpp: * svg/SVGNumberList.h: * svg/SVGPathStringBuilder.cpp: * svg/SVGPointList.h: * svg/SVGTransformValue.h: * svg/properties/SVGPropertyTraits.h: * testing/Internals.cpp: Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)) and builder.appendFixedWidthNumber(...) with with builder.append(FormattedNumber::fixedWidth(...)) Source/WebKit: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)). Source/WTF: In an ongoing attempt to simplify the StringBuilder interface and unify it's functionality with makeString, this change removes appendFixedPrecisionNumber() and appendFixedWidthNumber(), replacing their uses with direct calls to append(), using a FormattedNumber object to direct it to the appropriate StringTypeAdapter. * wtf/text/StringBuilder.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendFixedPrecisionNumber): Deleted. (WTF::StringBuilder::appendFixedWidthNumber): Deleted. Remove StringBuilder::appendFixedPrecisionNumber() and StringBuilder::appendFixedWidthNumber(). The same functionality is available and more flexible by passing FormattedNumbers to the variadic append() function. * wtf/text/TextStream.cpp: (WTF::TextStream::operator<<): * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)) and builder.appendFixedWidthNumber(...) with with builder.append(FormattedNumber::fixedWidth(...)) Tools: * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)). Canonical link: https://commits.webkit.org/218851@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-02 19:31:56 +00:00
builder.append(FormattedNumber::fixedPrecision(number));
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, numbers...);
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
void appendMatrix(StringBuilder& builder) const
{
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_matrix->a(), m_matrix->b(), m_matrix->c(), m_matrix->d(), m_matrix->e(), m_matrix->f());
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
void appendTranslate(StringBuilder& builder) const
{
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_matrix->e(), m_matrix->f());
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
void appendScale(StringBuilder& builder) const
{
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_matrix->value().xScale(), m_matrix->value().yScale());
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
void appendRotate(StringBuilder& builder) const
{
double angleInRad = deg2rad(m_angle);
double cosAngle = std::cos(angleInRad);
double sinAngle = std::sin(angleInRad);
float cx = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix->e() * (1 - cosAngle) - m_matrix->f() * sinAngle) / (1 - cosAngle) / 2 : 0);
float cy = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix->e() * sinAngle / (1 - cosAngle) + m_matrix->f()) / 2 : 0);
if (cx || cy)
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_angle, cx, cy);
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
else
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_angle);
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
void appendSkewX(StringBuilder& builder) const
{
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_angle);
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
void appendSkewY(StringBuilder& builder) const
{
Change String::number to use "shortest" instead of "fixed precision 6 digits" https://bugs.webkit.org/show_bug.cgi?id=178319 Reviewed by Sam Weinig. Source/WebCore: * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision instead of String::number to be explicit about the fact that it's fixed precision. * page/linux/ResourceUsageOverlayLinux.cpp: (gcTimerString): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. (printLayer): Ditto. (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/graphics/freetype/FontCacheFreeType.cpp: (buildVariationSettings): Ditto. * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Use appendNumberShortest instead of appendNumberECMAScript since these are single-precision. * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber to be explicit about the fact that it's fixed precision. We'll consider moving to shortest later. * svg/SVGTransformValue.h: Ditto. Source/WTF: * wtf/text/StringBuilder.h: Delete appendNumber for floating point and appendECMAScriptNumber for single-precision. * wtf/text/WTFString.h: Delete String::number for floating point and numberToStringECMAScript for single-precision. Tools: * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::testStringNumberFixedPrecision): Use String::numberToStringFixedPrecision. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (attributesOfElement): Use appendFixedPrecisionNumber. Canonical link: https://commits.webkit.org/212124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-19 18:17:40 +00:00
appendFixedPrecisionNumbers(builder, m_angle);
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
}
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
SVGTransformType m_type { SVG_TRANSFORM_UNKNOWN };
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
Ref<SVGMatrix> m_matrix;
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
float m_angle { 0 };
Remove the SVG tear off objects for SVGMatrix, SVGTransfrom, SVGTransformList and SVGAnimatedTransformList https://bugs.webkit.org/show_bug.cgi?id=196086 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-04-01 Reviewed by Simon Fraser. Source/WebCore: The IDL changes: SVGTransform.idl: Remove the NewObject qualifier from matrix attribute. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform. SVGTransform will internally hold an SVGMatrix. A change in this SVGMatrix will affect the container SVGTransform. SVGTransformList.idl: Remove the NewObject qualifier from consolidate() method. This matches the specs: https://www.w3.org/TR/SVG11/coords.html#__svg__SVGTransformList__consolidate The method consolidate() should return a reference to the first item in the list after consolidating it. Code changes: -- SVGMatrix is now a superclass of SVGValueProperty<AffineTransform>. No need for SVGMatrixValue since it was wrapper of AffineTransform. -- SVGTransformValue now holds a Ref<SVGMatrix> member in addition to the angle and the rotationCenter. Ref<SVGMatrix> is what SVGTransform.matrix will return. So a change in this matrix will change the owner SVGTransform. -- SVGTransform is now the owner of SVGMatrix via its SVGTransformValue. -- SVGTransformList is now a superclass of SVGValuePropertyList<SVGTransform>. It is responsible for parsing a String to items of SVGTransform. -- SVGAnimatedTransformList is now defined as SVGAnimatedPropertyList< SVGTransformList>. Note the ownership chain of these objects is the following: -- SVGAnimatedTransformList owns the SVGTransformList via its baseVal and animVal members. -- SVGTransformList owns SVGTransform via its list of items -- SVGTransform owns SVGMatrix via its SVGTransformValue. So a change in SVGMatrix will propagate to the owner SVGElement through the following ownership chain: SVGMatrix |_ SVGTransfrom |_ SVGTransformList |_ SVGAmimatedTransformList |_ SVGElement To get the mechanics of this change right, a new accessor, a new animator and animation functions are added for the SVGAnimatedTransformList. -- SVGViewSpec used to hold an SVGAnimatedTransformListAttribute for the member m_transform although this member should not be animated. See the comment in the old SVGViewSpec::transform(). This has been changed in this patch. SVGViewSpec now holds Ref<SVGTransformList> which matches the specs: https://www.w3.org/TR/SVG11/types.html#InterfaceSVGViewSpec. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::attributeAnimationController): (WebCore::SVGAnimateElementBase::hasValidAttributeType const): (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue): (WebCore::SVGAnimateElementBase::calculateFromAndToValues): (WebCore::SVGAnimateElementBase::calculateFromAndByValues): * svg/SVGAnimateElementBase.h: (WebCore::SVGAnimateElementBase::animateRangeString const): * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::animateRangeString const): * svg/SVGAnimateTransformElement.h: This change is needed because animating the transform attribute can be written as <animate ... from="translate(100)" to="translate(200)"/> or <animateTransform type="translate" from="100" to="200"/>" So we need to surround the animation range string with the type qualifier for animateTransform. * svg/SVGAnimatedTransformList.cpp: Removed. * svg/SVGAnimatedTransformList.h: Removed. * svg/SVGAnimatedType.h: Removed. * svg/SVGAnimatedTypeAnimator.cpp: Removed. * svg/SVGAnimatedTypeAnimator.h: Removed. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. * svg/SVGAnimationElement.h: (WebCore::SVGAnimationElement::adjustForInheritance): Deleted. (WebCore::SVGAnimationElement::adjustFromToListValues): Deleted. (WebCore::SVGAnimationElement::animateDiscreteType): Deleted. These functions were used by SVGLegacyAttributeAnimationController. * svg/SVGAnimatorFactory.h: Removed. * svg/SVGExternalResourcesRequired.h: (WebCore::SVGExternalResourcesRequired::isKnownAttribute): * svg/SVGFEImageElement.h: * svg/SVGFEMorphologyElement.h: * svg/SVGFETileElement.h: * svg/SVGFitToViewBox.h: (WebCore::SVGFitToViewBox::isKnownAttribute): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement): (WebCore::SVGGradientElement::parseAttribute): (WebCore::SVGGradientElement::registerAttributes): Deleted. * svg/SVGGradientElement.h: (WebCore::SVGGradientElement::gradientTransform const): (WebCore::SVGGradientElement::gradientTransformAnimated): (WebCore::SVGGradientElement::isKnownAttribute): * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): (WebCore::SVGGraphicsElement::animatedLocalTransform const): (WebCore::SVGGraphicsElement::parseAttribute): (WebCore::SVGGraphicsElement::svgAttributeChanged): There is one attribute for this element which is "SVGNames::transformAttr" So there is no need to check for it twice. (WebCore::SVGGraphicsElement::registerAttributes): Deleted. * svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::transform const): (WebCore::SVGGraphicsElement::transformAnimated): (WebCore::SVGGraphicsElement::isKnownAttribute): Deleted. * svg/SVGLangSpace.cpp: (WebCore::SVGLangSpace::SVGLangSpace): (WebCore::SVGLangSpace::xmlspace const): (WebCore::SVGLangSpace::isKnownAttribute): (WebCore::SVGLangSpace::svgAttributeChanged): (WebCore::SVGLangSpace::registerAttributes): Deleted. * svg/SVGLangSpace.h: (WebCore::SVGLangSpace::xmllang const): (WebCore::SVGLangSpace::setXmllang): (WebCore::SVGLangSpace::setXmlspace): (WebCore::SVGLangSpace::attributeRegistry): Deleted. (WebCore::SVGLangSpace::isKnownAttribute): Deleted. * svg/SVGLegacyAttributeAnimationController.cpp: Removed. * svg/SVGLegacyAttributeAnimationController.h: Removed. * svg/SVGLinearGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGMaskElement.h: * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::a const): (WebCore::SVGMatrix::setA): (WebCore::SVGMatrix::b const): (WebCore::SVGMatrix::setB): (WebCore::SVGMatrix::c const): (WebCore::SVGMatrix::setC): (WebCore::SVGMatrix::d const): (WebCore::SVGMatrix::setD): (WebCore::SVGMatrix::e const): (WebCore::SVGMatrix::setE): (WebCore::SVGMatrix::f const): (WebCore::SVGMatrix::setF): (WebCore::SVGMatrix::multiply const): (WebCore::SVGMatrix::inverse const): (WebCore::SVGMatrix::translate const): (WebCore::SVGMatrix::scale const): (WebCore::SVGMatrix::scaleNonUniform const): (WebCore::SVGMatrix::rotate const): (WebCore::SVGMatrix::rotateFromVector const): (WebCore::SVGMatrix::flipX const): (WebCore::SVGMatrix::flipY const): (WebCore::SVGMatrix::skewX const): (WebCore::SVGMatrix::skewY const): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::SVGPatternElement): (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::svgAttributeChanged): (WebCore::SVGPatternElement::collectPatternAttributes const): (WebCore::SVGPatternElement::localCoordinateSpaceTransform const): (WebCore::SVGPatternElement::registerAttributes): Deleted. * svg/SVGPatternElement.h: * svg/SVGPoint.h: (WebCore::SVGPoint::matrixTransform const): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::isKnownAttribute): Deleted. * svg/SVGRadialGradientElement.cpp: (WebCore::setGradientAttributes): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): (WebCore::SVGSVGElement::viewBoxToViewTransform const): * svg/SVGTextElement.cpp: (WebCore::SVGTextElement::animatedLocalTransform const): * svg/SVGTransform.cpp: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::~SVGTransform): (WebCore::SVGTransform::clone const): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::matrix): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): (WebCore::SVGTransform::SVGTransform): * svg/SVGTransform.idl: * svg/SVGTransformList.h: * svg/SVGTransformList.idl: * svg/SVGTransformListValues.cpp: Removed. * svg/SVGTransformListValues.h: Removed. * svg/SVGTransformValue.cpp: Removed. * svg/SVGTransformValue.h: (WebCore::SVGTransformValue::SVGTransformValue): (WebCore::SVGTransformValue::operator=): (WebCore::SVGTransformValue::matrix const): (WebCore::SVGTransformValue::rotationCenter const): (WebCore::SVGTransformValue::isValid const): (WebCore::SVGTransformValue::setMatrix): (WebCore::SVGTransformValue::matrixDidChange): (WebCore::SVGTransformValue::translate const): (WebCore::SVGTransformValue::setTranslate): (WebCore::SVGTransformValue::scale const): (WebCore::SVGTransformValue::setScale): (WebCore::SVGTransformValue::setRotate): (WebCore::SVGTransformValue::setSkewX): (WebCore::SVGTransformValue::setSkewY): (WebCore::SVGTransformValue::valueAsString const): (WebCore::SVGTransformValue::prefixForTransfromType): (WebCore::SVGTransformValue::appendNumbers const): (WebCore::SVGTransformValue::appendMatrix const): (WebCore::SVGTransformValue::appendTranslate const): (WebCore::SVGTransformValue::appendScale const): (WebCore::SVGTransformValue::appendRotate const): (WebCore::SVGTransformValue::appendSkewX const): (WebCore::SVGTransformValue::appendSkewY const): (WebCore::SVGTransformValue::matrix): Deleted. * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseAndSkipType): (WebCore::parseAndSkipType): Deleted. (WebCore::SVGTransformable::parseTransformAttribute): Deleted. The code of this function was moved to SVGTransformList::parse(). * svg/SVGTransformable.h: There is no need for enum TransformParsingMode. It was used by SVGViewSpec::parseViewSpec() to tell SVGTransformable::parseTransformAttribute() not to clear the list. SVGTransfromList now has two parse() functions: one public and the second is private. The public one clear the list before parsing the input String. The private one just does the parsing. SVGViewSpec::parseViewSpec() calls the private once since it is a friend of SVGTransfromList. * svg/SVGValue.h: Removed. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): (WebCore::SVGViewSpec::reset): (WebCore::SVGViewSpec::parseViewSpec): (WebCore::SVGViewSpec::registerAttributes): Deleted. (WebCore::SVGViewSpec::transform): Deleted. * svg/SVGViewSpec.h: * svg/properties/SVGAnimatedPropertyAccessorImpl.h: * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: * svg/properties/SVGAnimatedPropertyImpl.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: Removed. * svg/properties/SVGAnimationAdditiveListFunctionImpl.h: (WebCore::SVGAnimationTransformListFunction::progress): * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: * svg/properties/SVGAttributeRegistry.h: * svg/properties/SVGMatrixTearOff.h: Removed. * svg/properties/SVGPropertyAccessorImpl.h: * svg/properties/SVGPropertyOwnerRegistry.h: (WebCore::SVGPropertyOwnerRegistry::registerProperty): LayoutTests: * svg/dom/SVGTransformList-basics-expected.txt: * svg/dom/SVGTransformList-basics.xhtml: These changes are required because SVGTransfromList will be following the SVG2 specs regarding adding new items to the list. See https://www.w3.org/TR/SVG/types.html#TermListInterface. Canonical link: https://commits.webkit.org/210742@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 01:31:54 +00:00
FloatPoint m_rotationCenter;
[SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. Canonical link: https://commits.webkit.org/182423@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-14 21:18:41 +00:00
};
} // namespace WebCore