WebKit Bugzilla
Attachment 356380 Details for
Bug 191237
: Remove SVG properties tear-off objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
4-SVGDecoratedEnumeration
4-SVGDecoratedEnumeration.patch (text/plain), 11.44 KB, created by
Said Abou-Hallawa
on 2018-12-03 08:00:49 PST
(
hide
)
Description:
4-SVGDecoratedEnumeration
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-12-03 08:00:49 PST
Size:
11.44 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4743626c757..81490bde668 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2018-12-03 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Remove SVG properties tear-off objects >+ https://bugs.webkit.org/show_bug.cgi?id=191237 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The enumeration property will be stored as 'enum' primitive but it has to >+ be exposed to the DOM as 'unsigned'. >+ >+ SVGAnimatedEnumeration will store two unique_ptrs for baseVal and animVal >+ of type SVGDecoratedProperty<unsigned> but the actual objects will be of >+ type SVGDecoratedEnumeration<EnumType>. This superclass will return unsigned >+ for the value but it will know how to convert a string to its EnmType. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * svg/properties/SVGDecoratedEnumeration.h: Added. >+ (WebCore::SVGDecoratedEnumeration::create): >+ * svg/properties/SVGDecoratedPrimitive.h: Added. >+ (WebCore::SVGDecoratedPrimitive::SVGDecoratedPrimitive): >+ * svg/properties/SVGDecoratedProperty.h: Added. >+ (WebCore::SVGDecoratedProperty::setValue): >+ (WebCore::SVGDecoratedProperty::value const): >+ > 2018-12-02 Said Abou-Hallawa <sabouhallawa@apple.com> > > Remove SVG properties tear-off objects >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index d51bdf89819..abf3a36e1e3 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -9325,6 +9325,9 @@ > 72227A7221B50901008EC3E4 /* SVGPropertyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyList.h; sourceTree = "<group>"; }; > 72227A7321B50901008EC3E4 /* SVGPrimitiveList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPrimitiveList.h; sourceTree = "<group>"; }; > 72227A7421B50901008EC3E4 /* SVGList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGList.h; sourceTree = "<group>"; }; >+ 72227A7521B586E7008EC3E4 /* SVGDecoratedEnumeration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDecoratedEnumeration.h; sourceTree = "<group>"; }; >+ 72227A7621B586E8008EC3E4 /* SVGDecoratedPrimitive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDecoratedPrimitive.h; sourceTree = "<group>"; }; >+ 72227A7721B586E8008EC3E4 /* SVGDecoratedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDecoratedProperty.h; sourceTree = "<group>"; }; > 724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTBlendMinMax.cpp; sourceTree = "<group>"; }; > 724ED32A1A3A7E5400F5F13C /* EXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTBlendMinMax.h; sourceTree = "<group>"; }; > 724ED32B1A3A7E5400F5F13C /* EXTBlendMinMax.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTBlendMinMax.idl; sourceTree = "<group>"; }; >@@ -15772,6 +15775,9 @@ > 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */, > 55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */, > 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */, >+ 72227A7521B586E7008EC3E4 /* SVGDecoratedEnumeration.h */, >+ 72227A7621B586E8008EC3E4 /* SVGDecoratedPrimitive.h */, >+ 72227A7721B586E8008EC3E4 /* SVGDecoratedProperty.h */, > 72227A7421B50901008EC3E4 /* SVGList.h */, > 0810764312828556007C63BA /* SVGListProperty.h */, > 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */, >diff --git a/Source/WebCore/svg/properties/SVGDecoratedEnumeration.h b/Source/WebCore/svg/properties/SVGDecoratedEnumeration.h >index 8b137891791..b12807672e6 100644 >--- a/Source/WebCore/svg/properties/SVGDecoratedEnumeration.h >+++ b/Source/WebCore/svg/properties/SVGDecoratedEnumeration.h >@@ -1 +1,69 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ > >+#pragma once >+ >+#include "SVGDecoratedPrimitive.h" >+ >+namespace WebCore { >+ >+template<typename DecorationType, typename EnumType> >+class SVGDecoratedEnumeration : public SVGDecoratedPrimitive<DecorationType, EnumType> { >+ using Base = SVGDecoratedPrimitive<DecorationType, EnumType>; >+ using Base::Base; >+ using Base::m_value; >+ >+public: >+ static auto create(const EnumType& value) >+ { >+ static_assert(std::is_integral<DecorationType>::value, "DecorationType form enum should be integral."); >+ return std::make_unique<SVGDecoratedEnumeration>(value); >+ } >+ >+private: >+ bool setValue(const DecorationType& value) override >+ { >+ if (!value || value > SVGIDLEnumLimits<EnumType>::highestExposedEnumValue()) >+ return false; >+ Base::setValueInternal(value); >+ return true; >+ } >+ >+ DecorationType value() const override >+ { >+ if (Base::value() > SVGIDLEnumLimits<EnumType>::highestExposedEnumValue()) >+ return m_outOfRangeEnumValue; >+ return Base::value(); >+ } >+ >+ std::unique_ptr<SVGDecoratedProperty<DecorationType>> clone() override >+ { >+ return create(m_value); >+ } >+ >+ static const DecorationType m_outOfRangeEnumValue = 0; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGDecoratedPrimitive.h b/Source/WebCore/svg/properties/SVGDecoratedPrimitive.h >index 8b137891791..1252c16b89d 100644 >--- a/Source/WebCore/svg/properties/SVGDecoratedPrimitive.h >+++ b/Source/WebCore/svg/properties/SVGDecoratedPrimitive.h >@@ -1 +1,53 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ > >+#pragma once >+ >+#include "SVGDecoratedProperty.h" >+ >+namespace WebCore { >+ >+template<typename DecorationType, typename PropertyType> >+class SVGDecoratedPrimitive : public SVGDecoratedProperty<DecorationType> { >+ using Base = SVGDecoratedProperty<DecorationType>; >+ >+public: >+ SVGDecoratedPrimitive(const PropertyType& value) >+ : m_value(value) >+ { >+ } >+ >+protected: >+ using Base::Base; >+ >+ void setValueInternal(const DecorationType& value) override { m_value = static_cast<PropertyType>(value); } >+ DecorationType valueInternal() const override { return static_cast<DecorationType>(m_value); } >+ >+ String valueAsString() const override { return SVGPropertyTraits<PropertyType>::toString(m_value); } >+ >+ PropertyType m_value; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGDecoratedProperty.h b/Source/WebCore/svg/properties/SVGDecoratedProperty.h >index 8b137891791..b3ba6268af5 100644 >--- a/Source/WebCore/svg/properties/SVGDecoratedProperty.h >+++ b/Source/WebCore/svg/properties/SVGDecoratedProperty.h >@@ -1 +1,53 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ > >+#pragma once >+ >+namespace WebCore { >+ >+template<typename DecorationType> >+class SVGDecoratedProperty { >+public: >+ SVGDecoratedProperty() = default; >+ virtual ~SVGDecoratedProperty() = default; >+ >+ virtual void setValueInternal(const DecorationType&) = 0; >+ virtual bool setValue(const DecorationType& value) >+ { >+ setValueInternal(value); >+ return true; >+ } >+ >+ // Used internally. It doesn't check for highestExposedEnumValue for example. >+ virtual DecorationType valueInternal() const = 0; >+ >+ // Used by the DOM APIs. >+ virtual DecorationType value() const { return valueInternal(); } >+ >+ virtual String valueAsString() const = 0; >+ virtual std::unique_ptr<SVGDecoratedProperty<DecorationType>> clone() = 0; >+}; >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 191237
:
353808
|
353812
|
353815
|
353817
|
353818
|
353820
|
353824
|
353825
|
355382
|
355386
|
355388
|
355393
|
355568
|
355574
|
355575
|
355577
|
355580
|
355582
|
355585
|
355666
|
355672
|
355693
|
355699
|
355711
|
355752
|
355777
|
355820
|
356333
|
356334
|
356338
|
356340
|
356342
|
356344
|
356346
|
356351
|
356352
|
356358
|
356360
|
356380
|
356497
|
356500
|
356507
|
356579
|
356607
|
356728
|
356729
|
356730
|
356731
|
356732
|
356733
|
356752
|
356810
|
356811
|
356879
|
356880
|
356881
|
356882
|
356883
|
356884
|
356885
|
356887
|
356888
|
356889
|
356892
|
356895
|
356896
|
359721
|
359735
|
359747
|
363581
|
363595
|
363613
|
363690
|
364172
|
364180
|
366512
|
366557
|
366636