2008-03-26 David Hyatt <hyatt@apple.com>
Add support for the rendering and measurement of the <altGlyph> element in SVG. This patch brings
is half of what's needed to reach 100/100 on Acid3 and pass the test. Maciej has coded up the other half. :)
Reviewed by mjs
Added svg/custom/altGlyph.svg
* svg/SVGAltGlyphElement.cpp:
(WebCore::SVGAltGlyphElement::childShouldCreateRenderer):
(WebCore::SVGAltGlyphElement::glyphElement):
* svg/SVGAltGlyphElement.h:
* svg/SVGFont.cpp:
(WebCore::SVGTextRunWalker::walk):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::insertedIntoDocument):
* svg/SVGGlyphElement.cpp:
(WebCore::SVGGlyphElement::insertedIntoDocument):
(WebCore::SVGGlyphElement::removedFromDocument):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/svg/SVGAltGlyphElement.cpp b/WebCore/svg/SVGAltGlyphElement.cpp
index 03696a0..8890d02 100644
--- a/WebCore/svg/SVGAltGlyphElement.cpp
+++ b/WebCore/svg/SVGAltGlyphElement.cpp
@@ -27,7 +27,9 @@
#include "ExceptionCode.h"
#include "RenderInline.h"
#include "RenderSVGTSpan.h"
+#include "SVGGlyphElement.h"
#include "SVGNames.h"
+#include "XLinkNames.h"
namespace WebCore {
@@ -64,7 +66,6 @@
{
if (child->isTextNode())
return true;
-
return false;
}
@@ -73,6 +74,14 @@
return new (arena) RenderSVGTSpan(this);
}
+SVGGlyphElement* SVGAltGlyphElement::glyphElement() const
+{
+ Element* elt = document()->getElementById(getTarget(getAttribute(XLinkNames::hrefAttr)));
+ if (!elt || !elt->hasTagName(SVGNames::glyphTag))
+ return 0;
+ return static_cast<SVGGlyphElement*>(elt);
+}
+
}
#endif // ENABLE(SVG)