Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1992)

Unified Diff: Source/core/svg/SVGUnknownElement.h

Issue 21498002: Introduce a SVGUnknownElement class for unknown SVG elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment for SVGUnknownElement Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGSymbolElement.h ('k') | Source/core/svg/SVGUnknownElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGUnknownElement.h
diff --git a/Source/core/svg/SVGNumber.h b/Source/core/svg/SVGUnknownElement.h
similarity index 65%
copy from Source/core/svg/SVGNumber.h
copy to Source/core/svg/SVGUnknownElement.h
index db47ed0dfb2ec33e7d6a538895fe9d8ff16ba61c..fe8d7e4dbe5dee0d8ab8123998113a7436b78e85 100644
--- a/Source/core/svg/SVGNumber.h
+++ b/Source/core/svg/SVGUnknownElement.h
@@ -28,49 +28,32 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SVGNumber_h
-#define SVGNumber_h
+#ifndef SVGUnknownElement_h
+#define SVGUnknownElement_h
-#include "core/svg/properties/SVGPropertyTraits.h"
+#include "core/svg/SVGElement.h"
namespace WebCore {
-class SVGNumber {
- WTF_MAKE_FAST_ALLOCATED;
+// This type is used for 2 kinds of elements:
+// - Unknown Elements in SVG namespace
+// - Registered custom tag elements in SVG namespace (http://www.w3.org/TR/2013/WD-custom-elements-20130514/#registering-custom-elements)
+//
+// The main purpose of this class at the moment is to override rendererIsNeeded() to return
+// false to make sure we don't attempt to render such elements.
+class SVGUnknownElement : public SVGElement {
public:
- SVGNumber()
- : m_value(0)
+ static PassRefPtr<SVGUnknownElement> create(const QualifiedName& tagName, Document* document)
{
+ return adoptRef(new SVGUnknownElement(tagName, document));
}
- SVGNumber(float value)
- : m_value(value)
- {
- }
-
- SVGNumber& operator+=(const SVGNumber& rhs)
- {
- m_value += rhs.value();
- return *this;
- }
-
- float value() const { return m_value; }
- float& valueRef() { return m_value; }
- String valueAsString() const { return String::number(m_value); }
- void setValue(float value) { m_value = value; }
-
private:
- float m_value;
-};
-
-COMPILE_ASSERT(sizeof(SVGNumber) == sizeof(float), SVGNumber_same_size_as_float);
+ SVGUnknownElement(const QualifiedName&, Document*);
-template<>
-struct SVGPropertyTraits<SVGNumber> {
- static SVGNumber initialValue() { return SVGNumber(); }
- static String toString(const SVGNumber& type) { return type.valueAsString(); }
+ virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE { return false; }
};
} // namespace WebCore
-#endif // SVGNumber_h
+#endif // SVGUnknownElement_h
« no previous file with comments | « Source/core/svg/SVGSymbolElement.h ('k') | Source/core/svg/SVGUnknownElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698