Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: Source/core/accessibility/AccessibilityRenderObject.cpp

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix include path Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/accessibility/AccessibilityRenderObject.cpp
diff --git a/Source/core/accessibility/AccessibilityRenderObject.cpp b/Source/core/accessibility/AccessibilityRenderObject.cpp
index 2b56ce40b6c75f9b4113196890430583e4cf4796..9e3e0d2dfaec2006346678fab1826895bc3e1e64 100644
--- a/Source/core/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/core/accessibility/AccessibilityRenderObject.cpp
@@ -32,6 +32,7 @@
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/accessibility/AccessibilityImageMapLink.h"
+#include "core/accessibility/AccessibilityInlineTextBox.h"
#include "core/accessibility/AccessibilitySVGRoot.h"
#include "core/accessibility/AccessibilitySpinButton.h"
#include "core/accessibility/AccessibilityTable.h"
@@ -52,6 +53,7 @@
#include "core/page/Frame.h"
#include "core/page/Page.h"
#include "core/rendering/HitTestResult.h"
+#include "core/rendering/RenderFieldset.h"
#include "core/rendering/RenderFileUploadControl.h"
#include "core/rendering/RenderHTMLCanvas.h"
#include "core/rendering/RenderImage.h"
@@ -1468,6 +1470,7 @@ void AccessibilityRenderObject::addChildren()
addTextFieldChildren();
addCanvasChildren();
addRemoteSVGChildren();
+ addInlineTextBoxChildren();
}
bool AccessibilityRenderObject::canHaveChildren() const
@@ -1734,6 +1737,17 @@ void AccessibilityRenderObject::handleAriaExpandedChanged()
axObjectCache()->postNotification(this, document(), isExpanded() ? AXObjectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true);
}
+void AccessibilityRenderObject::textChanged()
+{
+ if (!m_renderer)
+ return;
+
+ if (AXObjectCache::inlineTextBoxAccessibility() && roleValue() == StaticTextRole)
+ childrenChanged();
+
+ AccessibilityNodeObject::textChanged();
+}
+
//
// Text metrics. Most of these should be deprecated, needs major cleanup.
//
@@ -1801,6 +1815,25 @@ int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
return TextIterator::rangeLength(range.get());
}
+void AccessibilityRenderObject::addInlineTextBoxChildren()
+{
+ if (!axObjectCache()->inlineTextBoxAccessibility())
+ return;
+
+ if (!renderer() || !renderer()->isText())
+ return;
+
+ RenderText* renderText = toRenderText(renderer());
+ if (renderText->needsLayout())
+ renderText->document().updateLayoutIgnorePendingStylesheets();
+
+ for (RenderText::AbstractInlineTextBox* box = renderText->firstTextBox(); box; box = renderText->nextInlineTextBox(box)) {
+ AccessibilityObject* axObject = axObjectCache()->getOrCreate(renderText, box);
+ if (!axObject->accessibilityIsIgnored())
+ m_children.append(axObject);
+ }
+}
+
void AccessibilityRenderObject::lineBreaks(Vector<int>& lineBreaks) const
{
if (!isTextControl())

Powered by Google App Engine
This is Rietveld 408576698