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

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: 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
Index: Source/core/accessibility/AccessibilityRenderObject.cpp
diff --git a/Source/core/accessibility/AccessibilityRenderObject.cpp b/Source/core/accessibility/AccessibilityRenderObject.cpp
index abc2881a879034b8589c8abd5daefae32cb3f61a..2091aca3bc177813453bed2919b8fd1c75bab8aa 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/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"
@@ -1473,6 +1475,7 @@ void AccessibilityRenderObject::addChildren()
addTextFieldChildren();
addCanvasChildren();
addRemoteSVGChildren();
+ addInlineTextBoxChildren();
}
bool AccessibilityRenderObject::canHaveChildren() const
@@ -1739,6 +1742,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.
//
@@ -1806,6 +1820,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 (RefPtr<AbstractInlineTextBox> box = renderText->firstAbstractInlineTextBox(); box.get(); box = box->nextInlineTextBox()) {
eseidel 2013/10/17 18:43:26 This may be alot of mallocs. :) But this looks re
dmazzoni 2013/10/17 20:39:20 As long as it's constant in terms of the total num
+ AccessibilityObject* axObject = axObjectCache()->getOrCreate(box.get());
+ 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