Source/WebCore: Assert being hit in AccessibilityRenderObject::addChildren()

https://bugs.webkit.org/show_bug.cgi?id=61805

Patch by Dominic Mazzoni <dmazzoni@google.com> on 2011-09-09
Reviewed by Chris Fleizach.

Fix nextSibling and previousSibling to handle adjacent continuations
properly, otherwise nodes end up appearing in the accessibility
tree twice (or a debug assertion could be raised).

Test: accessibility/adjacent-continuations-cause-assertion-failure.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::previousSibling):
(WebCore::AccessibilityRenderObject::nextSibling):

LayoutTests: Add a test to catch a case where adjacent continuations were
causing nodes to get added to the accessibility tree twice, leading
to an assertion failure or a crash. The test expectations are
currently Mac-specific, so added the test to the Skipped file for
gtk and win.
https://bugs.webkit.org/show_bug.cgi?id=61805

Patch by Dominic Mazzoni <dmazzoni@google.com> on 2011-09-09
Reviewed by Chris Fleizach.

* accessibility/adjacent-continuations-cause-assertion-failure.html: Added.
* platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f1ab58f3
2011-09-09 Dominic Mazzoni <dmazzoni@google.com>
Add a test to catch a case where adjacent continuations were
causing nodes to get added to the accessibility tree twice, leading
to an assertion failure or a crash. The test expectations are
currently Mac-specific, so added the test to the Skipped file for
gtk and win.
https://bugs.webkit.org/show_bug.cgi?id=61805
Reviewed by Chris Fleizach.
* accessibility/adjacent-continuations-cause-assertion-failure.html: Added.
* platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Added.
2011-09-08 Kentaro Hara <haraken@google.com>
Implement a WebKitAnimationEvent constructor.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script>
var successfullyParsed = false;
function buildAccessibilityTree(accessibilityObject, indent) {
var str = "";
for (var i = 0; i < indent; i++)
str += " ";
str += accessibilityObject.role;
str += " " + accessibilityObject.stringValue;
str += "\n";
document.getElementById("tree").innerText += str;
if (accessibilityObject.stringValue.indexOf('End of test') >= 0)
return false;
var count = accessibilityObject.childrenCount;
for (var i = 0; i < count; ++i) {
if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1))
return false;
}
return true;
}
</script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<span><div></div></span><span>x<div>y</div>z</span>
<div>End of test</div>
<p id="description"></p>
<pre id="tree"></pre>
<div id="console"></div>
<script>
description("Make sure that a debug assert is not triggered when constructing the accessibility tree for this page.");
if (window.accessibilityController) {
// Build the accessibility tree up until 'End of test' is encountered.
document.body.focus();
buildAccessibilityTree(accessibilityController.focusedElement, 0);
}
successfullyParsed = true;
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
x
y
z
End of test
Make sure that a debug assert is not triggered when constructing the accessibility tree for this page.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
AXRole: AXWebArea AXValue:
AXRole: AXStaticText AXValue: x
AXRole: AXGroup AXValue:
AXRole: AXStaticText AXValue: y
AXRole: AXStaticText AXValue: z
AXRole: AXGroup AXValue:
AXRole: AXStaticText AXValue: End of test
PASS successfullyParsed is true
TEST COMPLETE
2011-09-09 Dominic Mazzoni <dmazzoni@google.com>
Assert being hit in AccessibilityRenderObject::addChildren()
https://bugs.webkit.org/show_bug.cgi?id=61805
Reviewed by Chris Fleizach.
Fix nextSibling and previousSibling to handle adjacent continuations
properly, otherwise nodes end up appearing in the accessibility
tree twice (or a debug assertion could be raised).
Test: accessibility/adjacent-continuations-cause-assertion-failure.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::previousSibling):
(WebCore::AccessibilityRenderObject::nextSibling):
2011-09-08 Kentaro Hara <haraken@google.com>
Implement a WebKitAnimationEvent constructor.
......@@ -305,8 +305,12 @@ AccessibilityObject* AccessibilityRenderObject::previousSibling() const
// Case 2: Anonymous block parent of the end of a continuation - skip all the way to before
// the parent of the start, since everything in between will be linked up via the continuation.
else if (m_renderer->isAnonymousBlock() && firstChildIsInlineContinuation(m_renderer))
previousSibling = startOfContinuations(m_renderer->firstChild())->parent()->previousSibling();
else if (m_renderer->isAnonymousBlock() && firstChildIsInlineContinuation(m_renderer)) {
RenderObject* firstParent = startOfContinuations(m_renderer->firstChild())->parent();
while (firstChildIsInlineContinuation(firstParent))
firstParent = startOfContinuations(firstParent->firstChild())->parent();
previousSibling = firstParent->previousSibling();
}
// Case 3: The node has an actual previous sibling
else if (RenderObject* ps = m_renderer->previousSibling())
......@@ -343,8 +347,12 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
// Case 2: Anonymous block parent of the start of a continuation - skip all the way to
// after the parent of the end, since everything in between will be linked up via the continuation.
else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_renderer))
nextSibling = endOfContinuations(m_renderer->lastChild())->parent()->nextSibling();
else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_renderer)) {
RenderObject* lastParent = endOfContinuations(m_renderer->lastChild())->parent();
while (lastChildHasContinuation(lastParent))
lastParent = endOfContinuations(lastParent->lastChild())->parent();
nextSibling = lastParent->nextSibling();
}
// Case 3: node has an actual next sibling
else if (RenderObject* ns = m_renderer->nextSibling())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment