+2006-04-17 Rob Buis <buis@kde.org>
+
+ Reviewed by eseidel. Landed by eseidel.
+
+ * svg/W3C-SVG-1.1/text-align-04-b-expected.txt:
+ * svg/W3C-SVG-1.1/text-tref-01-b-expected.txt:
+ * svg/custom/tref-update-expected.txt: Added.
+ * svg/custom/tref-update.svg: Added.
+
2006-04-18 Darin Adler <darin@apple.com>
Reviewed by Beth.
RenderInline {tspan} at (0,0) size 150x33
RenderText {#text} at (154,0) size 150x33
text run at (154,0) width 150: "bold tspan"
- RenderSVGText {text} at (0,0) size 465x0
+ RenderSVGText {text} at (0,0) size 465x34
+ RenderInline {tref} at (0,0) size 158x33
+ RenderText {#text} at (0,0) size 158x33
+ text run at (0,0) width 158: "end text tref"
+ RenderText {#text} at (0,0) size 0x0
RenderSVGText {text} at (0,0) size 465x0
RenderSVGText {text} at (0,0) size 465x46
RenderText {#text} at (0,0) size 264x46
RenderText {#text} at (0,0) size 281x14
text run at (0,0) width 281: "Test 'tref' element with an external referenced string."
RenderSVGText {text} at (0,0) size 465x0
+ RenderInline {tref} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
KCanvasItem {rect} at (72.50,182.50) size 261x23 [stroke={[type=SOLID] [color=#000000]}] [data="M73.00,183.00L333.00,183.00L333.00,205.00L73.00,205.00"]
RenderSVGText {text} at (0,0) size 465x14
RenderText {#text} at (0,0) size 154x14
--- /dev/null
+03db20b4add1fb29958fa9974811d466
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+ KCanvasContainer {svg} at (0,0) size 0x0
+ RenderSVGText {text} at (0,0) size 785x18
+ RenderInline {tref} at (0,0) size 50x18
+ RenderText {#text} at (0,0) size 50x18
+ text run at (0,0) width 50: "Success"
+ RenderText {#text} at (0,0) size 0x0
--- /dev/null
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
+<svg version="1.1" baseProfile="basic" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns="http://www.w3.org/2000/svg" onload="mytest()">
+ <script>
+ function mytest() {
+ var myTref = document.getElementById("tref");
+ myTref.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#tref-internal-reference-success");
+ }
+ </script>
+ <defs>
+ <text id="tref-internal-reference-fail">Failure</text>
+ <text id="tref-internal-reference-success">Success</text>
+ </defs>
+ <text x="20" y="20" >
+ <tref id="tref" xlink:href="#tref-internal-reference-failure"/>
+ </text>
+</svg>
+
+2006-04-17 Rob Buis <buis@kde.org>
+
+ Reviewed by eseidel. Landed by eseidel.
+
+ Test: svg/custom/tref-update.svg
+
+ Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=6427:
+ <tref> element not implemented
+
+ Implementation of <tref> element.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * ksvg2/svg/SVGTRefElement.cpp: Added.
+ (SVGTRefElement::SVGTRefElement):
+ (SVGTRefElement::~SVGTRefElement):
+ (SVGTRefElement::parseMappedAttribute):
+ (SVGTRefElement::closeRenderer):
+ (SVGTRefElement::childShouldCreateRenderer):
+ (SVGTRefElement::createRenderer):
+ * ksvg2/svg/SVGTRefElement.h: Added.
+ (WebCore::SVGTRefElement::rendererIsNeeded):
+ * ksvg2/svg/SVGTSpanElement.cpp:
+ (SVGTSpanElement::childShouldCreateRenderer):
+ * ksvg2/svg/SVGTextElement.cpp:
+ (WebCore::SVGTextElement::childShouldCreateRenderer):
+ * ksvg2/svg/svgtags.in:
+
2006-04-18 Darin Adler <darin@apple.com>
* rendering/render_form.cpp: (WebCore::RenderSelect::updateFromElement):
65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
7E6FEED80898582300C44C3F /* WebCoreScriptDebugger.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEED60898582300C44C3F /* WebCoreScriptDebugger.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E6FEED90898582300C44C3F /* WebCoreScriptDebugger.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E6FEED70898582300C44C3F /* WebCoreScriptDebugger.mm */; };
+ 8116895F09F2A4A000772CA0 /* SVGTRefElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8116895D09F2A4A000772CA0 /* SVGTRefElement.cpp */; };
+ 8116896009F2A4A000772CA0 /* SVGTRefElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8116895E09F2A4A000772CA0 /* SVGTRefElement.h */; };
93032CC809AEC34300F82A18 /* PathCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93032CC709AEC34300F82A18 /* PathCG.cpp */; };
93032CCA09AEC34B00F82A18 /* Path.h in Headers */ = {isa = PBXBuildFile; fileRef = 93032CC909AEC34B00F82A18 /* Path.h */; };
9305B24D098F1B6B00C28855 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305B24C098F1B6B00C28855 /* Timer.h */; };
65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
7E6FEED60898582300C44C3F /* WebCoreScriptDebugger.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreScriptDebugger.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
7E6FEED70898582300C44C3F /* WebCoreScriptDebugger.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreScriptDebugger.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 8116895D09F2A4A000772CA0 /* SVGTRefElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTRefElement.cpp; sourceTree = "<group>"; };
+ 8116895E09F2A4A000772CA0 /* SVGTRefElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGTRefElement.h; sourceTree = "<group>"; };
840633070731A77200DB1FD1 /* libxslt.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxslt.dylib; path = /usr/lib/libxslt.dylib; sourceTree = "<absolute>"; };
84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreKeyGenerator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
A8C0F7FC089701F300BA5114 /* svg */ = {
isa = PBXGroup;
children = (
+ 8116895D09F2A4A000772CA0 /* SVGTRefElement.cpp */,
+ 8116895E09F2A4A000772CA0 /* SVGTRefElement.h */,
A8C0F7FF089701F300BA5114 /* SVGAElement.cpp */,
A8C0F800089701F300BA5114 /* SVGAElement.h */,
A8C0F801089701F300BA5114 /* SVGAngle.cpp */,
93B70EB309EEE5B5009D8468 /* RenderEmptyApplet.h in Headers */,
1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */,
1403BA0F09EB18F900797C7F /* JSDOMWindow.h in Headers */,
+ 8116896009F2A4A000772CA0 /* SVGTRefElement.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
93B70EB209EEE5B5009D8468 /* RenderEmptyApplet.cpp in Sources */,
1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
+ 8116895F09F2A4A000772CA0 /* SVGTRefElement.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- /dev/null
+/*
+ Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ 2004, 2005 Rob Buis <buis@kde.org>
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+#if SVG_SUPPORT
+#include "Text.h"
+#include "SVGTRefElement.h"
+#include "SVGNames.h"
+#include "XLinkNames.h"
+#include "SVGAnimatedString.h"
+#include "SVGDocument.h"
+#include "RenderInline.h"
+
+using namespace WebCore;
+
+SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document *doc)
+: SVGTextPositioningElement(tagName, doc), SVGURIReference()
+{
+}
+
+SVGTRefElement::~SVGTRefElement()
+{
+}
+
+void SVGTRefElement::updateReferencedText()
+{
+ String targetId = SVGURIReference::getTarget(String(href()->baseVal()).deprecatedString());
+ Element *targetElement = ownerDocument()->getElementById(targetId.impl());
+ SVGElement *target = svg_dynamic_cast(targetElement);
+ if (target) {
+ ExceptionCode ignore = 0;
+ setTextContent(target->textContent().impl(), ignore);
+ }
+}
+
+void SVGTRefElement::attributeChanged(Attribute* attr, bool preserveDecls)
+{
+ if (attr->name().matches(XLinkNames::hrefAttr))
+ updateReferencedText();
+
+ SVGTextPositioningElement::attributeChanged(attr, preserveDecls);
+}
+
+void SVGTRefElement::parseMappedAttribute(MappedAttribute *attr)
+{
+ if (SVGURIReference::parseMappedAttribute(attr)) {
+ updateReferencedText();
+ return;
+ }
+
+ SVGTextPositioningElement::parseMappedAttribute(attr);
+}
+
+bool SVGTRefElement::childShouldCreateRenderer(WebCore::Node *child) const
+{
+ if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag) ||
+ child->hasTagName(SVGNames::trefTag))
+ return true;
+ return false;
+}
+
+RenderObject *SVGTRefElement::createRenderer(RenderArena *arena, RenderStyle *)
+{
+ return new (arena) RenderInline(this);
+}
+
+// vim:ts=4:noet
+#endif // SVG_SUPPORT
+
--- /dev/null
+/*
+ Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ 2004, 2005 Rob Buis <buis@kde.org>
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef KSVG_SVGTRefElementImpl_H
+#define KSVG_SVGTRefElementImpl_H
+#if SVG_SUPPORT
+
+#include "SVGURIReference.h"
+#include "SVGTextPositioningElement.h"
+
+namespace WebCore
+{
+ class SVGTRefElement : public SVGTextPositioningElement, public SVGURIReference
+ {
+ public:
+ SVGTRefElement(const QualifiedName& tagName, Document *doc);
+ virtual ~SVGTRefElement();
+
+ virtual void attributeChanged(Attribute* attr, bool preserveDecls);
+ virtual void parseMappedAttribute(MappedAttribute *attr);
+
+ virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
+ virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style);
+ bool childShouldCreateRenderer(WebCore::Node *child) const;
+
+ private:
+ void updateReferencedText();
+ };
+};
+
+#endif // SVG_SUPPORT
+#endif
+
+// vim:ts=4:noet
bool SVGTSpanElement::childShouldCreateRenderer(WebCore::Node *child) const
{
- if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag))
+ if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag) ||
+ child->hasTagName(SVGNames::trefTag))
return true;
return false;
}
bool SVGTextElement::childShouldCreateRenderer(Node *child) const
{
- if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag))
+ if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag) ||
+ child->hasTagName(SVGNames::trefTag))
return true;
return false;
}
text
#textPath
title
-#tref
+tref
tspan
use
view