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

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: Fixed compilation error. 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
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..87ef7a1ebb5031b740c87ef5e361b48fa446c1e4 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();
}
@@ -335,6 +337,7 @@ blink::WebRect BoundsForCharacter(const blink::WebAXObject& object,
DCHECK(character_offsets.size() > 0 &&
character_offsets.size() == inline_text_box.stringValue().length());
switch (inline_text_box.textDirection()) {
+ case blink::WebAXTextDirectionUnknown:
case blink::WebAXTextDirectionLR: {
if (localIndex) {
int left = inline_text_box_rect.x + character_offsets[localIndex - 1];
@@ -509,6 +512,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 +829,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)

Powered by Google App Engine
This is Rietveld 408576698