SVN commit 525132 by buis: Support for and <style>, however the latter does not seem to work yet. M +11 -0 misc/hashes.cpp M +4 -0 misc/hashes.h M +0 -6 svg/CONVERSION-TODO-LIST M +1 -0 svg/Makefile.am A svg/SVGStyleElementImpl.cpp [License: LGPL (v2+) (wrong address)] A svg/SVGStyleElementImpl.h [License: LGPL (v2+) (wrong address)] A svg/SVGTitleElementImpl.cpp [License: LGPL (v2+) (wrong address)] A svg/SVGTitleElementImpl.h [License: LGPL (v2+) (wrong address)] M +38 -1 xml/dom_docimpl.cpp --- branches/work/khtml-svg/misc/hashes.cpp #525131:525132 @@ -52,6 +52,17 @@ } } +#if SVG_SUPPORT +int khtml::getTagIDSVG(const char *tagStr, int len) +{ + const struct tags_svg *tagPtr = findTagSVG(tagStr, len); + if (!tagPtr) + return 0; + + return tagPtr->id; +} +#endif + const char *khtml::getTagName(unsigned short id) { { // HTML Tags --- branches/work/khtml-svg/misc/hashes.h #525131:525132 @@ -38,6 +38,10 @@ int getTagID(const char *tagStr, int len); const char *getTagName(unsigned short id); +#if SVG_SUPPORT + int getTagIDSVG(const char *tagStr, int len); +#endif + // Attrs name <-> id resolution int getAttrID(const char *tagStr, int len); const char *getAttrName(unsigned short id); --- branches/work/khtml-svg/svg/CONVERSION-TODO-LIST #525131:525132 @@ -33,18 +33,12 @@ SVGScriptElementImpl.cpp SVGScriptElementImpl.h -SVGTitleElementImpl.cpp -SVGTitleElementImpl.h - SVGUseElementImpl.cpp SVGUseElementImpl.h SVGSolidColorElementImpl.cpp SVGSolidColorElementImpl.h -SVGStyleElementImpl.cpp -SVGStyleElementImpl.h - LATER - Animations ------------------ SVGAnimateColorElementImpl.cpp --- branches/work/khtml-svg/svg/Makefile.am #525131:525132 @@ -31,4 +31,5 @@ SVGGradientElementImpl.cpp SVGLinearGradientElementImpl.cpp \ SVGRadialGradientElementImpl.cpp SVGDOMImplementationImpl.cpp \ SVGAElementImpl.cpp SVGClipPathElementImpl.cpp \ + SVGTitleElementImpl.cpp SVGStyleElementImpl.cpp \ svgpathparser.cpp KSVGPainterFactory.cpp --- branches/work/khtml-svg/xml/dom_docimpl.cpp #525131:525132 @@ -96,6 +96,8 @@ #include "svg/SVGPathElementImpl.h" #include "svg/SVGLineElementImpl.h" #include "svg/SVGViewElementImpl.h" +#include "svg/SVGTitleElementImpl.h" +#include "svg/SVGStyleElementImpl.h" #include "svg/SVGSwitchElementImpl.h" #include "svg/SVGCircleElementImpl.h" #include "svg/SVGSymbolElementImpl.h" @@ -1016,7 +1018,7 @@ #if SVG_SUPPORT ElementImpl *DocumentImpl::createSVGElement( const DOMString &name ) { - uint id = khtml::getTagID( name.string().toLatin1().constData(), name.string().length() ); + uint id = khtml::getTagIDSVG( name.string().toLatin1().constData(), name.string().length() ); ElementImpl *n = 0; switch(id) @@ -1116,6 +1118,16 @@ n = new KSVG::SVGRadialGradientElementImpl(docPtr()); break; } + case SVGID_TITLE: + { + n = new KSVG::SVGTitleElementImpl(docPtr()); + break; + } + case SVGID_STYLE: + { + n = new KSVG::SVGStyleElementImpl(docPtr()); + break; + } default: break; } @@ -2208,6 +2220,31 @@ } } } +#if SVG_SUPPORT + else if (n->isSVGElement() && n->id() == SVGID_STYLE) { + QString title; + // <STYLE> element + KSVG::SVGStyleElementImpl *s = static_cast<KSVG::SVGStyleElementImpl*>(n); + if (!s->isLoading()) { + sheet = s->sheet(); + if(sheet) + title = s->getAttribute(SVGID_TITLE).string(); + } + + if (!title.isEmpty() && m_preferredStylesheetSet.isEmpty()) + m_preferredStylesheetSet = title; + + if (!title.isEmpty()) { + if (title != m_preferredStylesheetSet) + sheet = 0; // don't use it + + title = title.replace('&', "&&"); + + if (!m_availableSheets.contains(title)) + m_availableSheets.append(title); + } + } +#endif else { // <STYLE> element HTMLStyleElementImpl* s = static_cast<HTMLStyleElementImpl*>(n);