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

Unified Diff: content/shell/renderer/test_runner/web_ax_object_proxy.cc

Issue 1130733006: Adds color, font size, text direction and text styles to the accessibility tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt at exposing style info to the native APIs. Created 5 years, 7 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 | « content/shell/renderer/test_runner/web_ax_object_proxy.h ('k') | ui/accessibility/ax_enums.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/web_ax_object_proxy.cc
diff --git a/content/shell/renderer/test_runner/web_ax_object_proxy.cc b/content/shell/renderer/test_runner/web_ax_object_proxy.cc
index bf77fe13344fe59cea9621d87001b40e74a30c4b..c47df9b8c25db7c124051b34dc136eb44aef7e4e 100644
--- a/content/shell/renderer/test_runner/web_ax_object_proxy.cc
+++ b/content/shell/renderer/test_runner/web_ax_object_proxy.cc
@@ -268,10 +268,12 @@ std::string DeprecatedGetHelpText(const blink::WebAXObject& object) {
std::string GetStringValue(const blink::WebAXObject& object) {
std::string value;
if (object.role() == blink::WebAXRoleColorWell) {
- int r, g, b;
- object.colorValue(r, g, b);
- value = base::StringPrintf("rgb %7.5f %7.5f %7.5f 1",
- r / 255., g / 255., b / 255.);
+ unsigned int color = object.colorValue();
+ unsigned int red = (color >> 16) & 0xFF;
+ unsigned int green = (color >> 8) & 0xFF;
+ unsigned int blue = color & 0xFF;
+ value = base::StringPrintf("rgba(%d, %d, %d, 1)",
+ red, green, blue);
} else {
value = object.stringValue().utf8();
}
@@ -509,6 +511,10 @@ WebAXObjectProxy::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetProperty("hasPopup", &WebAXObjectProxy::HasPopup)
.SetProperty("isValid", &WebAXObjectProxy::IsValid)
.SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly)
+ .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor)
+ .SetProperty("color", &WebAXObjectProxy::Color)
+ .SetProperty("colorValue", &WebAXObjectProxy::ColorValue)
+ .SetProperty("fontSize", &WebAXObjectProxy::FontSize)
.SetProperty("orientation", &WebAXObjectProxy::Orientation)
.SetProperty("posInSet", &WebAXObjectProxy::PosInSet)
.SetProperty("setSize", &WebAXObjectProxy::SetSize)
@@ -822,6 +828,29 @@ bool WebAXObjectProxy::IsReadOnly() {
return accessibility_object_.isReadOnly();
}
+unsigned int WebAXObjectProxy::BackgroundColor() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ return accessibility_object_.backgroundColor();
+}
+
+unsigned int WebAXObjectProxy::Color() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ unsigned int color = accessibility_object_.color();
+ // Remove the alpha because it's always 1 and thus not informative.
+ return color & 0xFFFFFF;
+}
+
+// For input elements of type color.
+unsigned int WebAXObjectProxy::ColorValue() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ return accessibility_object_.colorValue();
+}
+
+float WebAXObjectProxy::FontSize() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+ return accessibility_object_.fontSize();
+}
+
std::string WebAXObjectProxy::Orientation() {
accessibility_object_.updateLayoutAndCheckValidity();
if (accessibility_object_.orientation() == blink::WebAXOrientationVertical)
« no previous file with comments | « content/shell/renderer/test_runner/web_ax_object_proxy.h ('k') | ui/accessibility/ax_enums.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698