Diff
Copied: branches/chromium/782/LayoutTests/svg/custom/crash-text-in-textpath-expected.txt (from rev 90156, trunk/LayoutTests/svg/custom/crash-text-in-textpath-expected.txt) (0 => 90861)
--- branches/chromium/782/LayoutTests/svg/custom/crash-text-in-textpath-expected.txt (rev 0)
+++ branches/chromium/782/LayoutTests/svg/custom/crash-text-in-textpath-expected.txt 2011-07-12 22:29:39 UTC (rev 90861)
@@ -0,0 +1,3 @@
+foo
+Test for bug 63076: Assertion failure in RenderSVGInlineText::characterStartsNewTextChunk
+This test passes if it does not crash
Copied: branches/chromium/782/LayoutTests/svg/custom/crash-text-in-textpath.svg (from rev 90156, trunk/LayoutTests/svg/custom/crash-text-in-textpath.svg) (0 => 90861)
--- branches/chromium/782/LayoutTests/svg/custom/crash-text-in-textpath.svg (rev 0)
+++ branches/chromium/782/LayoutTests/svg/custom/crash-text-in-textpath.svg 2011-07-12 22:29:39 UTC (rev 90861)
@@ -0,0 +1,20 @@
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<text>
+ <textPath id="textPath">
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ // This triggers a layout before adding the #text node.
+ document.getElementById('textPath').scrollIntoView('foo');
+ </script>
+ foo
+ <script>
+ // This triggers a layout after adding the #text node to fire the ASSERT.
+ document.getElementById('textPath').scrollIntoView('foo');
+ </script>
+ </textPath>
+</text>
+<text x="10" y="50">Test for bug <a xlink:href="" Assertion failure in RenderSVGInlineText::characterStartsNewTextChunk</text>
+<text x="10" y="100">This test passes if it does not crash</text>
+</svg>
Copied: branches/chromium/782/LayoutTests/svg/custom/text-node-in-text-invalidated-expected.txt (from rev 90156, trunk/LayoutTests/svg/custom/text-node-in-text-invalidated-expected.txt) (0 => 90861)
--- branches/chromium/782/LayoutTests/svg/custom/text-node-in-text-invalidated-expected.txt (rev 0)
+++ branches/chromium/782/LayoutTests/svg/custom/text-node-in-text-invalidated-expected.txt 2011-07-12 22:29:39 UTC (rev 90861)
@@ -0,0 +1,3 @@
+foo bar
+Test for bug 63076: Assertion failure in RenderSVGInlineText::characterStartsNewTextChunk
+This test passes if it does not crash
Copied: branches/chromium/782/LayoutTests/svg/custom/text-node-in-text-invalidated.svg (from rev 90156, trunk/LayoutTests/svg/custom/text-node-in-text-invalidated.svg) (0 => 90861)
--- branches/chromium/782/LayoutTests/svg/custom/text-node-in-text-invalidated.svg (rev 0)
+++ branches/chromium/782/LayoutTests/svg/custom/text-node-in-text-invalidated.svg 2011-07-12 22:29:39 UTC (rev 90861)
@@ -0,0 +1,20 @@
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<text id="text">
+ bar
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ // This triggers a layout before adding the #text node.
+ document.getElementById('text').scrollIntoView('foo');
+
+ var text = document.getElementById('text');
+ text.insertBefore(document.createTextNode('foo'), text.firstChild);
+
+ // This triggers a layout after adding the #text node to fire the ASSERT.
+ document.getElementById('text').scrollIntoView('foo');
+ </script>
+</text>
+<text x="10" y="50">Test for bug <a xlink:href="" Assertion failure in RenderSVGInlineText::characterStartsNewTextChunk</text>
+<text x="10" y="100">This test passes if it does not crash</text>
+</svg>
Modified: branches/chromium/782/Source/WebCore/svg/SVGTextContentElement.cpp (90860 => 90861)
--- branches/chromium/782/Source/WebCore/svg/SVGTextContentElement.cpp 2011-07-12 22:21:29 UTC (rev 90860)
+++ branches/chromium/782/Source/WebCore/svg/SVGTextContentElement.cpp 2011-07-12 22:29:39 UTC (rev 90861)
@@ -29,6 +29,7 @@
#include "FrameSelection.h"
#include "RenderObject.h"
#include "RenderSVGResource.h"
+#include "RenderSVGText.h"
#include "SVGDocumentExtensions.h"
#include "SVGElementInstance.h"
#include "SVGNames.h"
@@ -333,6 +334,17 @@
return static_cast<SVGTextContentElement*>(node);
}
+void SVGTextContentElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+
+ if (changedByParser || !renderer())
+ return;
+
+ if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(renderer()))
+ textRenderer->setNeedsPositioningValuesUpdate();
}
+}
+
#endif // ENABLE(SVG)
Modified: branches/chromium/782/Source/WebCore/svg/SVGTextContentElement.h (90860 => 90861)
--- branches/chromium/782/Source/WebCore/svg/SVGTextContentElement.h 2011-07-12 22:21:29 UTC (rev 90860)
+++ branches/chromium/782/Source/WebCore/svg/SVGTextContentElement.h 2011-07-12 22:29:39 UTC (rev 90861)
@@ -72,6 +72,7 @@
void fillPassedAttributeToPropertyTypeMap(AttributeToPropertyTypeMap&);
virtual bool selfHasRelativeLengths() const;
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
private:
virtual bool isTextContent() const { return true; }
Modified: branches/chromium/782/Source/WebCore/svg/SVGTextPositioningElement.cpp (90860 => 90861)
--- branches/chromium/782/Source/WebCore/svg/SVGTextPositioningElement.cpp 2011-07-12 22:21:29 UTC (rev 90860)
+++ branches/chromium/782/Source/WebCore/svg/SVGTextPositioningElement.cpp 2011-07-12 22:29:39 UTC (rev 90861)
@@ -108,30 +108,6 @@
ASSERT_NOT_REACHED();
}
-static inline void updatePositioningValuesInRenderer(RenderObject* renderer)
-{
- RenderSVGText* textRenderer = 0;
-
- if (renderer->isSVGText())
- textRenderer = toRenderSVGText(renderer);
- else {
- // Locate RenderSVGText parent renderer.
- RenderObject* parent = renderer->parent();
- while (parent && !parent->isSVGText())
- parent = parent->parent();
-
- if (parent) {
- ASSERT(parent->isSVGText());
- textRenderer = toRenderSVGText(parent);
- }
- }
-
- if (!textRenderer)
- return;
-
- textRenderer->setNeedsPositioningValuesUpdate();
-}
-
void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -154,7 +130,8 @@
return;
if (updateRelativeLengths || attrName == SVGNames::rotateAttr) {
- updatePositioningValuesInRenderer(renderer);
+ if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(renderer))
+ textRenderer->setNeedsPositioningValuesUpdate();
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
}
@@ -162,17 +139,6 @@
ASSERT_NOT_REACHED();
}
-void SVGTextPositioningElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
-{
- SVGTextContentElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-
- if (changedByParser)
- return;
-
- if (RenderObject* object = renderer())
- updatePositioningValuesInRenderer(object);
-}
-
void SVGTextPositioningElement::synchronizeProperty(const QualifiedName& attrName)
{
if (attrName == anyQName()) {
Modified: branches/chromium/782/Source/WebCore/svg/SVGTextPositioningElement.h (90860 => 90861)
--- branches/chromium/782/Source/WebCore/svg/SVGTextPositioningElement.h 2011-07-12 22:21:29 UTC (rev 90860)
+++ branches/chromium/782/Source/WebCore/svg/SVGTextPositioningElement.h 2011-07-12 22:29:39 UTC (rev 90861)
@@ -37,7 +37,6 @@
bool isSupportedAttribute(const QualifiedName&);
virtual void parseMappedAttribute(Attribute*);
- virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
void fillPassedAttributeToPropertyTypeMap(AttributeToPropertyTypeMap&);