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

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: Remove platform differences from inline-text-textarea output Created 7 years, 3 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 aae67d2f0361824bf53f513a01eac73f6e7ae43b..f110fe495abfe1bb0c5d9a081b60474a254ebc3c 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,8 @@
#include "core/page/Page.h"
#include "core/platform/LocalizedStrings.h"
#include "core/rendering/HitTestResult.h"
+#include "core/rendering/InlineTextBox.h"
+#include "core/rendering/RenderFieldset.h"
#include "core/rendering/RenderFileUploadControl.h"
#include "core/rendering/RenderHTMLCanvas.h"
#include "core/rendering/RenderImage.h"
@@ -1466,6 +1469,7 @@ void AccessibilityRenderObject::addChildren()
addTextFieldChildren();
addCanvasChildren();
addRemoteSVGChildren();
+ addInlineTextBoxChildren();
}
bool AccessibilityRenderObject::canHaveChildren() const
@@ -1732,6 +1736,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.
//
@@ -1799,6 +1814,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 (InlineTextBox* box = renderText->firstTextBox(); box; box = box->nextTextBox()) {
+ AccessibilityObject* axObject = axObjectCache()->getOrCreate(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