summaryrefslogtreecommitdiffstats
path: root/WebCore/accessibility/AccessibilityRenderObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/accessibility/AccessibilityRenderObject.cpp')
-rw-r--r--WebCore/accessibility/AccessibilityRenderObject.cpp44
1 files changed, 36 insertions, 8 deletions
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index 24c29d4..6b90b63 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -354,10 +354,10 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
else if (isInlineWithContinuation(m_renderer->parent())) {
RenderObject* continuation = toRenderInline(m_renderer->parent())->continuation();
- // Case 4a: continuation is a block - in this case the block itself is the next sibling.
+ // Case 5a: continuation is a block - in this case the block itself is the next sibling.
if (continuation->isRenderBlock())
nextSibling = continuation;
- // Case 4b: continuation is an inline - in this case the inline's first child is the next sibling
+ // Case 5b: continuation is an inline - in this case the inline's first child is the next sibling
else
nextSibling = firstChildConsideringContinuation(continuation);
}
@@ -368,6 +368,13 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
return axObjectCache()->getOrCreate(nextSibling);
}
+static RenderBoxModelObject* nextContinuation(RenderObject* renderer)
+{
+ if (renderer->isInline() && !renderer->isReplaced())
+ return toRenderInline(renderer)->continuation();
+ return toRenderBlock(renderer)->inlineElementContinuation();
+}
+
RenderObject* AccessibilityRenderObject::renderParentObject() const
{
if (!m_renderer)
@@ -377,7 +384,8 @@ RenderObject* AccessibilityRenderObject::renderParentObject() const
// Case 1: node is a block and is an inline's continuation. Parent
// is the start of the continuation chain.
- RenderInline* startOfConts = 0;
+ RenderObject* startOfConts = 0;
+ RenderObject* firstChild = 0;
if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_renderer)))
parent = startOfConts;
@@ -386,6 +394,20 @@ RenderObject* AccessibilityRenderObject::renderParentObject() const
else if (parent && parent->isRenderInline() && (startOfConts = startOfContinuations(parent)))
parent = startOfConts;
+ // Case 3: The first sibling is the beginning of a continuation chain. Find the origin of that continuation.
+ else if (parent && (firstChild = parent->firstChild()) && firstChild->node()) {
+ // Get the node's renderer and follow that continuation chain until the first child is found
+ RenderObject* nodeRenderFirstChild = firstChild->node()->renderer();
+ if (nodeRenderFirstChild != firstChild) {
+ for (RenderObject* contsTest = nodeRenderFirstChild; contsTest; contsTest = nextContinuation(contsTest)) {
+ if (contsTest == firstChild) {
+ parent = nodeRenderFirstChild->parent();
+ break;
+ }
+ }
+ }
+ }
+
return parent;
}
@@ -486,8 +508,9 @@ bool AccessibilityRenderObject::isFileUploadButton() const
bool AccessibilityRenderObject::isInputImage() const
{
- if (m_renderer && m_renderer->node() && m_renderer->node()->hasTagName(inputTag)) {
- HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->node());
+ Node* elementNode = node();
+ if (roleValue() == ButtonRole && elementNode && elementNode->hasTagName(inputTag)) {
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(elementNode);
return input->inputType() == HTMLInputElement::IMAGE;
}
@@ -569,8 +592,11 @@ bool AccessibilityRenderObject::isIndeterminate() const
bool AccessibilityRenderObject::isNativeCheckboxOrRadio() const
{
Node* elementNode = node();
- if (elementNode && elementNode->isElementNode())
- return toInputElement(static_cast<Element*>(elementNode));
+ if (elementNode && elementNode->isElementNode()) {
+ InputElement* input = toInputElement(static_cast<Element*>(elementNode));
+ if (input)
+ return input->isCheckbox() || input->isRadioButton();
+ }
return false;
}
@@ -3299,8 +3325,10 @@ void AccessibilityRenderObject::addChildren()
unsigned length = children.size();
for (unsigned i = 0; i < length; ++i)
m_children.append(children[i]);
- } else
+ } else {
+ ASSERT(obj->parentObject() == this);
m_children.append(obj);
+ }
}
// for a RenderImage, add the <area> elements as individual accessibility objects