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

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

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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
« no previous file with comments | « Source/core/accessibility/AXRenderObject.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/accessibility/AXRenderObject.cpp
diff --git a/Source/core/accessibility/AXRenderObject.cpp b/Source/core/accessibility/AXRenderObject.cpp
index 64acaf898e077b9775bac1b940dfa6b9491a38a8..c84daad3d0c0dac80ce4cf6d9c52f207148d0b0a 100644
--- a/Source/core/accessibility/AXRenderObject.cpp
+++ b/Source/core/accessibility/AXRenderObject.cpp
@@ -31,6 +31,7 @@
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/accessibility/AXImageMapLink.h"
+#include "core/accessibility/AXInlineTextBox.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/accessibility/AXSVGRoot.h"
#include "core/accessibility/AXSpinButton.h"
@@ -52,6 +53,7 @@
#include "core/loader/ProgressTracker.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"
@@ -1472,6 +1474,7 @@ void AXRenderObject::addChildren()
addTextFieldChildren();
addCanvasChildren();
addRemoteSVGChildren();
+ addInlineTextBoxChildren();
}
bool AXRenderObject::canHaveChildren() const
@@ -1735,6 +1738,19 @@ void AXRenderObject::handleAriaExpandedChanged()
axObjectCache()->postNotification(this, document(), isExpanded() ? AXObjectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true);
}
+void AXRenderObject::textChanged()
+{
+ if (!m_renderer)
+ return;
+
+ if (AXObjectCache::inlineTextBoxAccessibility() && roleValue() == StaticTextRole)
+ childrenChanged();
+
+ // Do this last - AXNodeObject::textChanged posts live region announcements,
+ // and we should update the inline text boxes first.
+ AXNodeObject::textChanged();
+}
+
//
// Text metrics. Most of these should be deprecated, needs major cleanup.
//
@@ -1802,6 +1818,25 @@ int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const
return TextIterator::rangeLength(range.get());
}
+void AXRenderObject::addInlineTextBoxChildren()
+{
+ if (!axObjectCache()->inlineTextBoxAccessibility())
+ return;
+
+ if (!renderer() || !renderer()->isText())
+ return;
+
+ RenderText* renderText = toRenderText(renderer());
+ if (renderText->needsLayout())
+ renderText->document().updateLayoutIgnorePendingStylesheets();
+
+ for (RefPtr<AbstractInlineTextBox> box = renderText->firstAbstractInlineTextBox(); box.get(); box = box->nextInlineTextBox()) {
+ AXObject* axObject = axObjectCache()->getOrCreate(box.get());
+ if (!axObject->accessibilityIsIgnored())
+ m_children.append(axObject);
+ }
+}
+
void AXRenderObject::lineBreaks(Vector<int>& lineBreaks) const
{
if (!isTextControl())
« no previous file with comments | « Source/core/accessibility/AXRenderObject.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698