+2007-06-20 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Not reviewed.
+
+ Forgot to commit new layout tests results, now that <foreignObject> is enabled again.
+
+ * svg/W3C-SVG-1.1/masking-mask-01-b-expected.checksum:
+ * svg/W3C-SVG-1.1/masking-mask-01-b-expected.png:
+ * svg/custom/baseval-animval-equality-expected.checksum:
+ * svg/custom/baseval-animval-equality-expected.png:
+ * svg/custom/baseval-animval-equality-expected.txt:
+ * svg/custom/dynamic-svg-document-creation-expected.checksum:
+ * svg/custom/dynamic-svg-document-creation-expected.png:
+ * svg/custom/dynamic-svg-document-creation-expected.txt:
+ * svg/custom/foreign-object-skew-expected.checksum:
+ * svg/custom/foreign-object-skew-expected.png:
+ * svg/custom/foreign-object-skew-expected.txt:
+ * svg/custom/grayscale-gradient-mask-expected.checksum:
+ * svg/custom/grayscale-gradient-mask-expected.png:
+ * svg/custom/stroke-width-click-expected.txt:
+ * svg/hixie/mixed/006-expected.checksum:
+ * svg/hixie/mixed/006-expected.png:
+ * svg/hixie/mixed/006-expected.txt:
+ * svg/hixie/mixed/007-expected.checksum:
+ * svg/hixie/mixed/007-expected.png:
+ * svg/hixie/mixed/007-expected.txt:
+ * svg/hixie/mixed/008-expected.checksum:
+ * svg/hixie/mixed/008-expected.png:
+ * svg/hixie/mixed/008-expected.txt:
+ * svg/hixie/mixed/009-expected.checksum:
+ * svg/hixie/mixed/009-expected.png:
+ * svg/hixie/mixed/009-expected.txt:
+ * svg/hixie/mixed/011-expected.checksum:
+ * svg/hixie/mixed/011-expected.png:
+ * svg/hixie/mixed/011-expected.txt:
+
+2007-06-20 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Eric & Oliver.
+
+ Adding new testcase assuring <use> on <foreignObject> doesn't work.
+
+ * svg/custom/use-on-disallowed-foreign-object-1-expected.checksum: Added.
+ * svg/custom/use-on-disallowed-foreign-object-1-expected.png: Added.
+ * svg/custom/use-on-disallowed-foreign-object-1-expected.txt: Added.
+ * svg/custom/use-on-disallowed-foreign-object-1.svg: Added.
+ * svg/custom/use-on-disallowed-foreign-object-2-expected.checksum: Added.
+ * svg/custom/use-on-disallowed-foreign-object-2-expected.png: Added.
+ * svg/custom/use-on-disallowed-foreign-object-2-expected.txt: Added.
+ * svg/custom/use-on-disallowed-foreign-object-2.svg: Added.
+ * svg/custom/use-on-disallowed-foreign-object-3-expected.checksum: Added.
+ * svg/custom/use-on-disallowed-foreign-object-3-expected.png: Added.
+ * svg/custom/use-on-disallowed-foreign-object-3-expected.txt: Added.
+ * svg/custom/use-on-disallowed-foreign-object-3.svg: Added.
+ * svg/custom/use-on-disallowed-foreign-object-4-expected.checksum: Added.
+ * svg/custom/use-on-disallowed-foreign-object-4-expected.png: Added.
+ * svg/custom/use-on-disallowed-foreign-object-4-expected.txt: Added.
+ * svg/custom/use-on-disallowed-foreign-object-4.svg: Added.
+
2007-06-19 Rob Buis <buis@kde.org>
Reviewed by Oliver.
+SUCCESS: click at 10, 10 was correctly ignored
+SUCCESS: click received at: 30, 100
+SUCCESS: click at 29, 100 was correctly ignored
+SUCCESS: click received at: 30, 50
+SUCCESS: click at 30, 49 was correctly ignored
+SUCCESS: click received at: 30, 150
+SUCCESS: click at 30, 151 was correctly ignored
+SUCCESS: click received at: 300, 100
+SUCCESS: click at 301, 100 was correctly ignored
+SUCCESS: click received at: 300, 50
+SUCCESS: click at 300, 49 was correctly ignored
+SUCCESS: click received at: 300, 150
+SUCCESS: click at 300, 151 was correctly ignored
--- /dev/null
+e81802f52a73f3e6016c64d62aa87239
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+ RenderSVGContainer {svg} at (0,0) size 0x0
+ RenderForeignObject {foreignObject} at (0,0) size 480x360
+ RenderBlock {xhtml:div} at (0,0) size 480x18
+ RenderText {#text} at (0,0) size 244x18
+ text run at (0,0) width 244: "You should only see this string ONCE"
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+<foreignObject id="foreign" x="10" y="10" width="480" height="360" transform="scale(5) skewY(5) skewX(5)">
+<xhtml:div>You should only see this string ONCE</xhtml:div>
+</foreignObject>
+
+<use xlink:href="#foreign" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+</svg>
--- /dev/null
+e81802f52a73f3e6016c64d62aa87239
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+ RenderSVGContainer {svg} at (0,0) size 0x0
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderForeignObject {foreignObject} at (0,0) size 580x380
+ RenderBlock {xhtml:div} at (0,0) size 580x18
+ RenderText {#text} at (0,0) size 244x18
+ text run at (0,0) width 244: "You should only see this string ONCE"
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+<g id="foreign"><g>
+<foreignObject x="10" y="10" width="580" height="380" transform="scale(5) skewY(5) skewX(5)">
+<xhtml:div>You should only see this string ONCE</xhtml:div>
+</foreignObject>
+</g></g>
+
+<use xlink:href="#foreign" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+
+</svg>
--- /dev/null
+e81802f52a73f3e6016c64d62aa87239
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+ RenderSVGContainer {svg} at (0,0) size 0x0
+ RenderForeignObject {foreignObject} at (0,0) size 580x380
+ RenderBlock {xhtml:div} at (0,0) size 580x18
+ RenderText {#text} at (0,0) size 244x18
+ text run at (0,0) width 244: "You should only see this string ONCE"
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+<foreignObject id="foreign" x="10" y="10" width="580" height="380" transform="scale(5) skewY(5) skewX(5)">
+<xhtml:div>You should only see this string ONCE</xhtml:div>
+</foreignObject>
+
+<use id="test" xlink:href="#foreign" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+<use xlink:href="#test" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+
+</svg>
--- /dev/null
+e81802f52a73f3e6016c64d62aa87239
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+ RenderSVGContainer {svg} at (0,0) size 0x0
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderSVGContainer {g} at (0,0) size 0x0
+ RenderForeignObject {foreignObject} at (0,0) size 580x380
+ RenderBlock {xhtml:div} at (0,0) size 580x18
+ RenderText {#text} at (0,0) size 244x18
+ text run at (0,0) width 244: "You should only see this string ONCE"
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+<g id="foreign"><g>
+<foreignObject x="10" y="10" width="580" height="380" transform="scale(5) skewY(5) skewX(5)">
+<xhtml:div>You should only see this string ONCE</xhtml:div>
+</foreignObject>
+</g></g>
+
+<use id="test" xlink:href="#foreign" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+<use xlink:href="#test" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+
+</svg>
--- /dev/null
+e81802f52a73f3e6016c64d62aa87239
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+ RenderSVGContainer {svg} at (0,0) size 0x0
+ RenderForeignObject {foreignObject} at (0,0) size 480x360
+ RenderBlock {xhtml:div} at (0,0) size 480x18
+ RenderText {#text} at (0,0) size 244x18
+ text run at (0,0) width 244: "You should only see this string ONCE"
+ RenderSVGContainer {use} at (250,-50) size 0x0 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(250.00,-50.00)}]
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+<foreignObject x="10" y="10" width="480" height="360" transform="scale(5) skewY(5) skewX(5)">
+<xhtml:div id="foreign">You should only see this string ONCE</xhtml:div>
+</foreignObject>
+
+<use xlink:href="#foreign" x="10" y="10" width="200" height="200" transform="translate(250 -50) rotate(45)"/>
+</svg>
+2007-06-20 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Eric & Oliver.
+
+ Fixes: http://bugs.webkit.org/show_bug.cgi?id=14198
+
+ Reeanble <foreignObject>. Explicitely disallow <use> on <foreignObject>
+ as it may lead to bad problems.
+
+ While I'm at it disallow <use> on any non-svg element.
+
+ * bindings/js/JSSVGElementWrapperFactory.cpp:
+ * bindings/objc/DOM.mm:
+ (WebCore::createElementClassMap):
+ * ksvg2/svg/SVGForeignObjectElement.cpp:
+ * ksvg2/svg/SVGForeignObjectElement.h:
+ * ksvg2/svg/SVGForeignObjectElement.idl:
+ * ksvg2/svg/SVGLocatable.cpp:
+ (WebCore::SVGLocatable::nearestViewportElement):
+ (WebCore::SVGLocatable::farthestViewportElement):
+ * ksvg2/svg/SVGUseElement.cpp:
+ (WebCore::SVGUseElement::buildPendingResource):
+ * ksvg2/svg/svgtags.in:
+ * rendering/RenderForeignObject.cpp:
+
2007-06-19 Rob Buis <buis@kde.org>
Reviewed by Oliver.
macro(defs, Defs) \
macro(desc, Desc) \
macro(ellipse, Ellipse) \
+ macro(foreignObject, ForeignObject) \
macro(g, G) \
macro(image, Image) \
macro(linearGradient, LinearGradient) \
addElementClass(SVGNames::feTileTag, [DOMSVGFETileElement class]);
addElementClass(SVGNames::feTurbulenceTag, [DOMSVGFETurbulenceElement class]);
addElementClass(SVGNames::filterTag, [DOMSVGFilterElement class]);
- addElementClass(SVGNames::foreignObjectTag, [DOMSVGForeignObjectElement class]);
#endif
+ addElementClass(SVGNames::foreignObjectTag, [DOMSVGForeignObjectElement class]);
addElementClass(SVGNames::gTag, [DOMSVGGElement class]);
addElementClass(SVGNames::imageTag, [DOMSVGImageElement class]);
addElementClass(SVGNames::lineTag, [DOMSVGLineElement class]);
#include "config.h"
-#if ENABLE(SVG) && ENABLE(SVG_EXPERIMENTAL_FEATURES)
-
+#if ENABLE(SVG)
#include "SVGForeignObjectElement.h"
+#include "CSSPropertyNames.h"
+#include "RenderForeignObject.h"
#include "SVGNames.h"
#include "SVGLength.h"
-#include "RenderForeignObject.h"
#include <wtf/Assertions.h>
-#include "CSSPropertyNames.h"
-
namespace WebCore {
SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document *doc)
#ifndef SVGForeignObjectElement_h
#define SVGForeignObjectElement_h
-#if ENABLE(SVG) && ENABLE(SVG_EXPERIMENTAL_FEATURES)
+#if ENABLE(SVG)
#include "SVGTests.h"
#include "SVGLangSpace.h"
module svg {
- interface [Conditional=SVG&SVG_EXPERIMENTAL_FEATURES] SVGForeignObjectElement : SVGElement,
+ interface [Conditional=SVG] SVGForeignObjectElement : SVGElement,
SVGTests,
SVGLangSpace,
SVGExternalResourcesRequired,
Node* n = e->parentNode();
while (n && !n->isDocumentNode()) {
if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::symbolTag) ||
- n->hasTagName(SVGNames::imageTag)
-#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
- || n->hasTagName(SVGNames::foreignObjectTag)
-#endif
- )
+ n->hasTagName(SVGNames::imageTag) || n->hasTagName(SVGNames::foreignObjectTag))
return static_cast<SVGElement*>(n);
n = n->parentNode();
Node* n = e->parentNode();
while (n && !n->isDocumentNode()) {
if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::symbolTag) ||
- n->hasTagName(SVGNames::imageTag)
-#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
- || n->hasTagName(SVGNames::foreignObjectTag)
-#endif
- )
+ n->hasTagName(SVGNames::imageTag) || n->hasTagName(SVGNames::foreignObjectTag))
farthest = static_cast<SVGElement*>(n);
n = n->parentNode();
}
#endif
+static bool subtreeContainsDisallowedElement(Node* start)
+{
+ if (start->hasTagName(SVGNames::foreignObjectTag))
+ return true;
+
+ for (Node* cur = start->firstChild(); cur; cur = cur->nextSibling()) {
+ if (subtreeContainsDisallowedElement(cur))
+ return true;
+ }
+
+ return false;
+}
+
void SVGUseElement::buildPendingResource()
{
// Do not build the shadow/instance tree for <use> elements living in a shadow tree.
Element* targetElement = ownerDocument()->getElementById(id);
SVGElement* target = svg_dynamic_cast(targetElement);
- // Do not allow self-referencing.
- if (!target || target == this)
+ // Do not allow self-referencing. Also explicitely disallow
+ // <use> on <foreignObject>, as that could lead to nasty bugs.
+ // 'target' may be null, if it's a non SVG namespaced element.
+ if (!target || target == this || subtreeContainsDisallowedElement(target))
return;
// Why a seperated instance/shadow tree? SVG demands it:
m_targetElementInstance = new SVGElementInstance(this, target);
// Eventually enter recursion to build SVGElementInstance objects for the sub-tree children
- bool foundCycle = false;
- buildInstanceTree(target, m_targetElementInstance.get(), foundCycle);
+ bool foundProblem = false;
+ buildInstanceTree(target, m_targetElementInstance.get(), foundProblem);
// SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it!
// Non-appearing <use> content is easier to debug, then half-appearing content.
- if (foundCycle) {
+ if (foundProblem) {
m_targetElementInstance = 0;
m_shadowTreeRootElement = 0;
return;
attachShadowTree();
}
-void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle)
+void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundProblem)
{
ASSERT(target);
ASSERT(targetInstance);
+ if (subtreeContainsDisallowedElement(target)) {
+ foundProblem = true;
+ return;
+ }
+
// A general description from the SVG spec, describing what buildInstanceTree() actually does.
//
// Spec: If the 'use' element references a 'g' which contains two 'rect' elements, then the instance tree
for (Node* node = target->firstChild(); node; node = node->nextSibling()) {
SVGElement* element = svg_dynamic_cast(node);
- // Skip any non-svg nodes.
+ // Skip any non-svg nodes or any disallowed element.
if (!element)
continue;
// Enter recursion, appending new instance tree nodes to the "instance" object.
if (element->hasChildNodes())
- buildInstanceTree(element, instancePtr, foundCycle);
+ buildInstanceTree(element, instancePtr, foundProblem);
// Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced
// object, the instance tree will contain recursive expansion of the indirect references to form a complete tree.
if (element->hasTagName(SVGNames::useTag))
- handleDeepUseReferencing(element, instancePtr, foundCycle);
+ handleDeepUseReferencing(element, instancePtr, foundProblem);
}
// Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced
// object, the instance tree will contain recursive expansion of the indirect references to form a complete tree.
if (target->hasTagName(SVGNames::useTag))
- handleDeepUseReferencing(target, targetInstance, foundCycle);
+ handleDeepUseReferencing(target, targetInstance, foundProblem);
}
-void SVGUseElement::handleDeepUseReferencing(SVGElement* use, SVGElementInstance* targetInstance, bool& foundCycle)
+void SVGUseElement::handleDeepUseReferencing(SVGElement* use, SVGElementInstance* targetInstance, bool& foundProblem)
{
String id = SVGURIReference::getTarget(use->href());
Element* targetElement = ownerDocument()->getElementById(id);
return;
// Cycle detection first!
- foundCycle = (target == this);
+ foundProblem = (target == this);
// Shortcut for self-references
- if (foundCycle)
+ if (foundProblem)
return;
SVGElementInstance* instance = targetInstance->parentNode();
SVGElement* element = instance->correspondingElement();
if (element->getIDAttribute() == id) {
- foundCycle = true;
+ foundProblem = true;
return;
}
targetInstance->appendChild(newInstance);
// Eventually enter recursion to build SVGElementInstance objects for the sub-tree children
- buildInstanceTree(target, newInstance, foundCycle);
+ buildInstanceTree(target, newInstance, foundProblem);
}
PassRefPtr<SVGSVGElement> SVGUseElement::buildShadowTreeForSymbolTag(SVGElement* target, SVGElementInstance* targetInstance)
font_face_src
font_face_uri
#endif
-#ifdef ENABLE_SVG_EXPERIMENTAL_FEATURES
foreignObject
-#endif
g
#if 0
glyph
#include "config.h"
-#if ENABLE(SVG) && ENABLE(SVG_EXPERIMENTAL_FEATURES)
-
+#if ENABLE(SVG)
#include "RenderForeignObject.h"
#include "GraphicsContext.h"