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

Unified Diff: webkit/glue/webaccessibility.cc

Issue 3013035: Add html node info (tag name, attributes, and computed display) and document... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add html node info (tag name, attributes, and computed display) and document... Created 10 years, 4 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 | « webkit/glue/webaccessibility.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webaccessibility.cc
===================================================================
--- webkit/glue/webaccessibility.cc (revision 57849)
+++ webkit/glue/webaccessibility.cc (working copy)
@@ -7,6 +7,13 @@
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebAttribute.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebDocumentType.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebNamedNodeMap.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebNode.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
using WebKit::WebAccessibilityCache;
@@ -288,7 +295,37 @@
attributes[ATTR_HELP] = src.helpText();
if (src.keyboardShortcut().length())
attributes[ATTR_SHORTCUT] = src.keyboardShortcut();
+ if (src.hasComputedStyle())
+ attributes[ATTR_DISPLAY] = src.computedStyleDisplay();
+ WebKit::WebNode node = src.node();
+
+ if (!node.isNull() && node.isElementNode()) {
+ WebKit::WebElement element = node.to<WebKit::WebElement>();
+ attributes[ATTR_HTML_TAG] = element.tagName();
+ for (unsigned i = 0; i < element.attributes().length(); i++) {
+ html_attributes.push_back(
+ std::pair<string16, string16>(
+ element.attributes().attributeItem(i).localName(),
+ element.attributes().attributeItem(i).value()));
+ }
+ }
+
+ if (role == WebAccessibility::ROLE_DOCUMENT ||
+ role == WebAccessibility::ROLE_WEB_AREA) {
+ WebKit::WebDocument document = src.document();
+ attributes[ATTR_DOC_TITLE] = document.title();
+ attributes[ATTR_DOC_URL] = document.frame()->url().spec().utf16();
+ if (document.isXHTMLDocument())
+ attributes[ATTR_DOC_MIMETYPE] = WebKit::WebString("text/xhtml");
+ else
+ attributes[ATTR_DOC_MIMETYPE] = WebKit::WebString("text/html");
+
+ WebKit::WebDocumentType doctype = document.doctype();
+ if (!doctype.isNull())
+ attributes[ATTR_DOC_DOCTYPE] = doctype.name();
+ }
+
// Add the source object to the cache and store its id.
id = cache->addOrGetId(src);
« no previous file with comments | « webkit/glue/webaccessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698