Title: [140429] trunk
Revision
140429
Author
[email protected]
Date
2013-01-22 08:52:49 -0800 (Tue, 22 Jan 2013)

Log Message

Asserts when textPath is used with no path
https://bugs.webkit.org/show_bug.cgi?id=107324

Reviewed by Eric Seidel.

Source/WebCore: 

We assert when there is no path associated with an SVG text path
element. Instead, this patch detects the condition and stops trying to
layout text for that textPath  element.

Test: svg/text/tpath-without-path.svg

* rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::beginTextPathLayout):
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):

LayoutTests: 

Test will assert in debug without this patch.

* svg/text/tpath-without-path-expected.txt: Added.
* svg/text/tpath-without-path.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140428 => 140429)


--- trunk/LayoutTests/ChangeLog	2013-01-22 16:41:26 UTC (rev 140428)
+++ trunk/LayoutTests/ChangeLog	2013-01-22 16:52:49 UTC (rev 140429)
@@ -1,3 +1,15 @@
+2013-01-18  Stephen Chenney  <[email protected]>
+
+        Asserts when textPath is used with no path
+        https://bugs.webkit.org/show_bug.cgi?id=107324
+
+        Reviewed by Eric Seidel.
+
+        Test will assert in debug without this patch.
+
+        * svg/text/tpath-without-path-expected.txt: Added.
+        * svg/text/tpath-without-path.svg: Added.
+
 2013-01-22  Krzysztof Czech  <[email protected]>
 
         [EFL] Unskipping some Accessibility Layout Tests for WK2.

Added: trunk/LayoutTests/svg/text/tpath-without-path-expected.txt (0 => 140429)


--- trunk/LayoutTests/svg/text/tpath-without-path-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tpath-without-path-expected.txt	2013-01-22 16:52:49 UTC (rev 140429)
@@ -0,0 +1,2 @@
+X
+Test Passes if you get an X, and no crash

Added: trunk/LayoutTests/svg/text/tpath-without-path.svg (0 => 140429)


--- trunk/LayoutTests/svg/text/tpath-without-path.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tpath-without-path.svg	2013-01-22 16:52:49 UTC (rev 140429)
@@ -0,0 +1,15 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+    <script>
+    	if (window.testRunner)
+    	    testRunner.dumpAsText();
+    </script>
+    <g transform="translate(25,25)">
+	    <text font-size="20">
+			<textPath text-anchor="middle">
+				<tspan>X</tspan>
+			</textPath>
+		</text>
+		<text y="25">Test Passes if you get an X, and no crash</text>
+	</g>
+</svg>
+

Modified: trunk/Source/WebCore/ChangeLog (140428 => 140429)


--- trunk/Source/WebCore/ChangeLog	2013-01-22 16:41:26 UTC (rev 140428)
+++ trunk/Source/WebCore/ChangeLog	2013-01-22 16:52:49 UTC (rev 140429)
@@ -1,3 +1,20 @@
+2013-01-18  Stephen Chenney  <[email protected]>
+
+        Asserts when textPath is used with no path
+        https://bugs.webkit.org/show_bug.cgi?id=107324
+
+        Reviewed by Eric Seidel.
+
+        We assert when there is no path associated with an SVG text path
+        element. Instead, this patch detects the condition and stops trying to
+        layout text for that textPath  element.
+
+        Test: svg/text/tpath-without-path.svg
+
+        * rendering/svg/SVGTextLayoutEngine.cpp:
+        (WebCore::SVGTextLayoutEngine::beginTextPathLayout):
+        (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
+
 2013-01-22  Andrey Adaikin  <[email protected]>
 
         Web Inspector: [Canvas] jump to prev/next drawing call in the replay

Modified: trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp (140428 => 140429)


--- trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp	2013-01-22 16:41:26 UTC (rev 140428)
+++ trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp	2013-01-22 16:52:49 UTC (rev 140429)
@@ -171,6 +171,8 @@
     RenderSVGTextPath* textPath = toRenderSVGTextPath(object);
 
     m_textPath = textPath->layoutPath();
+    if (m_textPath.isEmpty())
+        return;
     m_textPathStartOffset = textPath->startOffset();
     m_textPathLength = m_textPath.length();
     if (m_textPathStartOffset > 0 && m_textPathStartOffset <= 1)
@@ -423,6 +425,9 @@
 
 void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, RenderSVGInlineText* text, const RenderStyle* style)
 {
+    if (m_inPathLayout && m_textPath.isEmpty())
+        return;
+
     SVGElement* lengthContext = static_cast<SVGElement*>(text->parent()->node());
     
     RenderObject* textParent = text->parent();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to