From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/svg/SVGMaskElement.cpp | 96 +++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 45 deletions(-) (limited to 'Source/WebCore/svg/SVGMaskElement.cpp') diff --git a/Source/WebCore/svg/SVGMaskElement.cpp b/Source/WebCore/svg/SVGMaskElement.cpp index 42ed45ff5..f7a4180df 100644 --- a/Source/WebCore/svg/SVGMaskElement.cpp +++ b/Source/WebCore/svg/SVGMaskElement.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2005 Alexander Kellett * Copyright (C) 2009 Dirk Schulze * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. + * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,17 +23,15 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGMaskElement.h" -#include "Attribute.h" #include "RenderSVGResourceMasker.h" -#include "SVGElementInstance.h" #include "SVGNames.h" #include "SVGRenderSupport.h" +#include "SVGStringList.h" #include "SVGUnitTypes.h" #include "StyleResolver.h" +#include namespace WebCore { @@ -72,59 +71,59 @@ inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& do registerAnimatedPropertiesForSVGMaskElement(); } -PassRefPtr SVGMaskElement::create(const QualifiedName& tagName, Document& document) +Ref SVGMaskElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGMaskElement(tagName, document)); + return adoptRef(*new SVGMaskElement(tagName, document)); } bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) { - DEFINE_STATIC_LOCAL(HashSet, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { + static NeverDestroyed> supportedAttributes; + if (supportedAttributes.get().isEmpty()) { SVGTests::addSupportedAttributes(supportedAttributes); SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); - supportedAttributes.add(SVGNames::maskUnitsAttr); - supportedAttributes.add(SVGNames::maskContentUnitsAttr); - supportedAttributes.add(SVGNames::xAttr); - supportedAttributes.add(SVGNames::yAttr); - supportedAttributes.add(SVGNames::widthAttr); - supportedAttributes.add(SVGNames::heightAttr); + supportedAttributes.get().add(SVGNames::maskUnitsAttr); + supportedAttributes.get().add(SVGNames::maskContentUnitsAttr); + supportedAttributes.get().add(SVGNames::xAttr); + supportedAttributes.get().add(SVGNames::yAttr); + supportedAttributes.get().add(SVGNames::widthAttr); + supportedAttributes.get().add(SVGNames::heightAttr); } - return supportedAttributes.contains(attrName); + return supportedAttributes.get().contains(attrName); } void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - SVGParsingError parseError = NoError; - - if (!isSupportedAttribute(name)) - SVGElement::parseAttribute(name, value); - else if (name == SVGNames::maskUnitsAttr) { - SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits::fromString(value); + if (name == SVGNames::maskUnitsAttr) { + auto propertyValue = SVGPropertyTraits::fromString(value); if (propertyValue > 0) setMaskUnitsBaseValue(propertyValue); return; - } else if (name == SVGNames::maskContentUnitsAttr) { - SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits::fromString(value); + } + if (name == SVGNames::maskContentUnitsAttr) { + auto propertyValue = SVGPropertyTraits::fromString(value); if (propertyValue > 0) setMaskContentUnitsBaseValue(propertyValue); return; - } else if (name == SVGNames::xAttr) - setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); + } + + SVGParsingError parseError = NoError; + + if (name == SVGNames::xAttr) + setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::yAttr) - setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); + setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); else if (name == SVGNames::widthAttr) - setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); + setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::heightAttr) - setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); - else if (SVGTests::parseAttribute(name, value) - || SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { - } else - ASSERT_NOT_REACHED(); + setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); reportAttributeParsingError(parseError, name, value); + + SVGElement::parseAttribute(name, value); + SVGTests::parseAttribute(name, value); + SVGExternalResourcesRequired::parseAttribute(name, value); } void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) @@ -134,13 +133,15 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) return; } - SVGElementInstance::InvalidationGuard invalidationGuard(this); - + InstanceInvalidationGuard guard(*this); + if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr - || attrName == SVGNames::heightAttr) - updateRelativeLengthsInformation(); + || attrName == SVGNames::heightAttr) { + invalidateSVGPresentationAttributeStyle(); + return; + } if (RenderObject* object = renderer()) object->setNeedsLayout(); @@ -157,19 +158,24 @@ void SVGMaskElement::childrenChanged(const ChildChange& change) object->setNeedsLayout(); } -RenderPtr SVGMaskElement::createElementRenderer(PassRef style) +RenderPtr SVGMaskElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - return createRenderer(*this, std::move(style)); + return createRenderer(*this, WTFMove(style)); } -bool SVGMaskElement::selfHasRelativeLengths() const +Ref SVGMaskElement::requiredFeatures() { - return x().isRelative() - || y().isRelative() - || width().isRelative() - || height().isRelative(); + return SVGTests::requiredFeatures(*this); } +Ref SVGMaskElement::requiredExtensions() +{ + return SVGTests::requiredExtensions(*this); } -#endif // ENABLE(SVG) +Ref SVGMaskElement::systemLanguage() +{ + return SVGTests::systemLanguage(*this); +} + +} -- cgit v1.2.1