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

Unified Diff: Source/core/dom/Node.cpp

Issue 742353004: Implement computedRole and computedName (behind a flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Finished pulling out ScopedAXObjectCache etc. Many fprintfs remain. Created 6 years 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/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index b6a41e05c0776e04a007a9613f98db44ba72ccca..d40b1ae4f5776128ba4ab5a88cb4c1d8409c4093 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -75,6 +75,7 @@
#include "core/events/UIEvent.h"
#include "core/events/WheelEvent.h"
#include "core/frame/EventHandlerRegistry.h"
+#include "core/frame/FrameView.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
@@ -1418,6 +1419,46 @@ void Node::setTextContent(const String& text)
ASSERT_NOT_REACHED();
}
+const AtomicString& Node::computedRole()
+{
+ fprintf(stderr, "Node::computedRole()\n");
+ document().topDocument().view()->updateLayoutAndStyleIfNeededRecursive();
+ ScopedAXObjectCache cache(document());
+ fprintf(stderr, "got ScopedAXObjectCache\n");
+ PublicAXObject* axObj = cache->publicAXObjectForNode(this);
+ return axObj->computedRole();
+}
+
+const String Node::computedText()
+{
+ fprintf(stderr, "Node::computedText()\n");
+ document().topDocument().view()->updateLayoutAndStyleIfNeededRecursive();
+ ScopedAXObjectCache cache(document());
+ fprintf(stderr, "about to call %p->publicAXObjectForNode(%p)\n", cache.get(), this);
+ PublicAXObject* axObj = cache->publicAXObjectForNode(this);
+ fprintf(stderr, "about to call %p->computedText()\n", axObj);
+ String computedText = axObj->computedText();
+ fprintf(stderr, "got computedText: %s\n", computedText.characters8());
+ return computedText;
+ /*
+ Settings* settings = this->document().settings();
+ if (!settings)
+ return String();
+ settings->setAccessibilityEnabled(true);
+
+ fprintf(stderr, "computedText()\n");
+ if (!document().topDocument().view())
+ return String();
+ AXObjectCache* cache = document().alwaysCreateAxObjectCache();
+ AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache);
+ AXObject* axObj = cacheImpl->getOrCreate(this);
+ if (axObj == NULL)
+ return String();
+ // TODO(aboxhall): figure out why this is crashing
+ return axObj->title();
+ */
+}
+
bool Node::offsetInCharacters() const
{
return false;

Powered by Google App Engine
This is Rietveld 408576698