- Revision
- 112119
- Author
- [email protected]
- Date
- 2012-03-26 10:25:09 -0700 (Mon, 26 Mar 2012)
Log Message
Source/WebCore: Failure to invalidate text position attributes when DOM changes
https://bugs.webkit.org/show_bug.cgi?id=81464
Reviewed by Nikolas Zimmermann.
The text positioning elements data structure in RenderSVGText must be
updated when either the children of the corresponding element are
modified, or the length of the text inside the elements changes.
Previously, the call to clear the text positioning elements (to force
recomputation) was guarded by a flag. If code tried to invalidate when
the flag was not set, then something set the flag, the elements would
be invalid at use time.
This patch modifies the method that invalidates the positining
attributes so that the action always happens. It also renames the
method to more accurately reflect its function.
Test: svg/custom/delete-modified-text-in-defs-crash.svg
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::setTextInternal): Rename textDOMChanged to invalidateTextPositioningElements
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::invalidateTextPositioningElements): Rename
textDOMChanged to invalidateTextPositioningElements and remove the check against the needsPosition... flag.
* rendering/svg/RenderSVGText.h:
(RenderSVGText): Rename textDOMChanged to invalidateTextPositioningElements
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::childrenChanged): Rename textDOMChanged to invalidateTextPositioningElements
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::childrenChanged): Rename textDOMChanged to invalidateTextPositioningElements
LayoutTests: Failure to invalidate text position attributes when DOM changes
https://bugs.webkit.org/show_bug.cgi?id=81464
Reviewed by Nikolas Zimmermann.
* svg/custom/delete-modified-text-in-defs-crash-expected.txt: Added.
* svg/custom/delete-modified-text-in-defs-crash.svg: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (112118 => 112119)
--- trunk/LayoutTests/ChangeLog 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/LayoutTests/ChangeLog 2012-03-26 17:25:09 UTC (rev 112119)
@@ -1,3 +1,13 @@
+2012-03-26 Stephen Chenney <[email protected]>
+
+ Failure to invalidate text position attributes when DOM changes
+ https://bugs.webkit.org/show_bug.cgi?id=81464
+
+ Reviewed by Nikolas Zimmermann.
+
+ * svg/custom/delete-modified-text-in-defs-crash-expected.txt: Added.
+ * svg/custom/delete-modified-text-in-defs-crash.svg: Added.
+
2012-03-26 Florin Malita <[email protected]>
Rebaseline zoom-foreignObject.svg CR results
Added: trunk/LayoutTests/svg/custom/delete-modified-text-in-defs-crash-expected.txt (0 => 112119)
--- trunk/LayoutTests/svg/custom/delete-modified-text-in-defs-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/custom/delete-modified-text-in-defs-crash-expected.txt 2012-03-26 17:25:09 UTC (rev 112119)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/svg/custom/delete-modified-text-in-defs-crash.svg (0 => 112119)
--- trunk/LayoutTests/svg/custom/delete-modified-text-in-defs-crash.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/delete-modified-text-in-defs-crash.svg 2012-03-26 17:25:09 UTC (rev 112119)
@@ -0,0 +1,29 @@
+<svg id="svgRoot" xmlns="http://www.w3.org/2000/svg" _onload_="go()">
+ <defs>
+ <text>
+ <tspan id="tspan1" x="375"></tspan>
+ <tspan>PASS</tspan>
+ </text>
+ </defs>
+ <g><rect id="legendbox"/></g>
+ <script><![CDATA[
+ document.execCommand("SelectAll");
+ elem = document.getElementById("tspan1");
+ elem.removeAttribute("x");
+ range = document.createRange();
+ range.setStartBefore(document.getElementById("tspan1"));
+ range.setEndAfter(document.getElementById("legendbox"));
+ range.deleteContents();
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function go() {
+ var svgRoot = document.getElementById("svgRoot");
+ var passText = document.createElementNS("http://www.w3.org/2000/svg", "text");
+ var textContent = document.createTextNode("PASS");
+ passText.appendChild(textContent);
+ svgRoot.appendChild(passText);
+ }
+ ]]></script>
+</svg>
Modified: trunk/Source/WebCore/ChangeLog (112118 => 112119)
--- trunk/Source/WebCore/ChangeLog 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/Source/WebCore/ChangeLog 2012-03-26 17:25:09 UTC (rev 112119)
@@ -1,3 +1,36 @@
+2012-03-26 Stephen Chenney <[email protected]>
+
+ Failure to invalidate text position attributes when DOM changes
+ https://bugs.webkit.org/show_bug.cgi?id=81464
+
+ Reviewed by Nikolas Zimmermann.
+
+ The text positioning elements data structure in RenderSVGText must be
+ updated when either the children of the corresponding element are
+ modified, or the length of the text inside the elements changes.
+ Previously, the call to clear the text positioning elements (to force
+ recomputation) was guarded by a flag. If code tried to invalidate when
+ the flag was not set, then something set the flag, the elements would
+ be invalid at use time.
+
+ This patch modifies the method that invalidates the positining
+ attributes so that the action always happens. It also renames the
+ method to more accurately reflect its function.
+
+ Test: svg/custom/delete-modified-text-in-defs-crash.svg
+
+ * rendering/svg/RenderSVGInlineText.cpp:
+ (WebCore::RenderSVGInlineText::setTextInternal): Rename textDOMChanged to invalidateTextPositioningElements
+ * rendering/svg/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::invalidateTextPositioningElements): Rename
+ textDOMChanged to invalidateTextPositioningElements and remove the check against the needsPosition... flag.
+ * rendering/svg/RenderSVGText.h:
+ (RenderSVGText): Rename textDOMChanged to invalidateTextPositioningElements
+ * svg/SVGAElement.cpp:
+ (WebCore::SVGAElement::childrenChanged): Rename textDOMChanged to invalidateTextPositioningElements
+ * svg/SVGTextContentElement.cpp:
+ (WebCore::SVGTextContentElement::childrenChanged): Rename textDOMChanged to invalidateTextPositioningElements
+
2012-03-26 Julien Chaffraix <[email protected]>
REGRESSION (r110065-r110080): fast/forms/placeholder-set-attribute.html is failing intermittently because WebKit fails to repaint after setting the placeholder attribute
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp (112118 => 112119)
--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp 2012-03-26 17:25:09 UTC (rev 112119)
@@ -99,7 +99,7 @@
// the RenderSVGInlineText objects, and thus needs to be rebuild. The latter will assure that the
// SVGTextLayoutAttributes associated with the RenderSVGInlineText will be updated.
if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this)) {
- textRenderer->textDOMChanged();
+ textRenderer->invalidateTextPositioningElements();
textRenderer->layoutAttributesChanged(this);
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (112118 => 112119)
--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp 2012-03-26 17:25:09 UTC (rev 112119)
@@ -6,6 +6,7 @@
* Copyright (C) 2008 Rob Buis <[email protected]>
* Copyright (C) 2009 Dirk Schulze <[email protected]>
* Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
+ * Copyright (C) 2012 Google Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -177,10 +178,12 @@
affectedAttributes.append(next);
}
-void RenderSVGText::textDOMChanged()
+void RenderSVGText::invalidateTextPositioningElements()
{
- if (m_needsPositioningValuesUpdate)
- return;
+ // Clear the text positioning elements. This should be called when either the children
+ // of a DOM text element have changed, or the length of the text in any child element
+ // has changed. Failure to clear may leave us with invalid elements, as other code paths
+ // do not always cause the position elements to be marked invalid before use.
m_layoutAttributesBuilder.clearTextPositioningElements();
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.h (112118 => 112119)
--- trunk/Source/WebCore/rendering/svg/RenderSVGText.h 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.h 2012-03-26 17:25:09 UTC (rev 112119)
@@ -49,7 +49,10 @@
bool needsReordering() const { return m_needsReordering; }
- void textDOMChanged();
+ // Call this method when either the children of a DOM text element have changed, or the length of
+ // the text in any child element has changed.
+ void invalidateTextPositioningElements();
+
void layoutAttributesChanged(RenderObject*);
void layoutAttributesWillBeDestroyed(RenderSVGInlineText*, Vector<SVGTextLayoutAttributes*>& affectedAttributes);
void rebuildLayoutAttributes(bool performFullRebuild = false);
Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (112118 => 112119)
--- trunk/Source/WebCore/svg/SVGAElement.cpp 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp 2012-03-26 17:25:09 UTC (rev 112119)
@@ -248,7 +248,7 @@
// Invalidate the TextPosition cache in SVGTextLayoutAttributesBuilder as it may now point
// to no-longer existing SVGTextPositioningElements and thus needs to be rebuilt.
if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(renderer()))
- textRenderer->textDOMChanged();
+ textRenderer->invalidateTextPositioningElements();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGTextContentElement.cpp (112118 => 112119)
--- trunk/Source/WebCore/svg/SVGTextContentElement.cpp 2012-03-26 17:22:21 UTC (rev 112118)
+++ trunk/Source/WebCore/svg/SVGTextContentElement.cpp 2012-03-26 17:25:09 UTC (rev 112119)
@@ -331,7 +331,7 @@
// Invalidate the TextPosition cache in SVGTextLayoutAttributesBuilder as it may now point
// to no-longer existing SVGTextPositioningElements and thus needs to be rebuilt.
if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(renderer()))
- textRenderer->textDOMChanged();
+ textRenderer->invalidateTextPositioningElements();
}
}