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

Unified Diff: content/browser/web_contents/web_contents_android.cc

Issue 1137393003: Add style information to the snapshot node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address code review (dependency and non-existent style) 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/browser/web_contents/web_contents_android.cc
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc
index dc23623cf475b2867bf7d055483f239f88f0bd7c..2464e5c2cdbaec99063c68e3b74bc21b41b07511 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -60,11 +60,25 @@ ScopedJavaLocalRef<jobject> WalkAXTreeDepthFirst(JNIEnv* env,
ScopedJavaLocalRef<jstring> j_class =
ConvertUTF8ToJavaString(env, node->GetClassName());
const gfx::Rect& location = node->GetLocation();
+ // The style attributes exists and valid if size attribute exists. Otherwise,
+ // they are not. Use a negative size information to indicate the existence
+ // of style information.
+ float size = -1.0;
+ int color = 0;
+ int bgcolor = 0;
+ int text_style = 0;
+ if (node->HasFloatAttribute(ui::AX_ATTR_FONT_SIZE)) {
+ color = node->GetIntAttribute(ui::AX_ATTR_COLOR);
Ted C 2015/05/29 17:04:29 can you add a DCHECK above each one of these using
dmazzoni 2015/05/29 17:06:01 No, we deliberately filter out zero values and emp
Ted C 2015/05/29 17:10:37 Huh? So HasFloatAttribute returns false if the va
sgurun-gerrit only 2015/05/29 17:23:19 I will add a todo and a crbug and we can discuss h
+ bgcolor = node->GetIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR);
+ size = node->GetFloatAttribute(ui::AX_ATTR_FONT_SIZE);
+ text_style = node->GetIntAttribute(ui::AX_ATTR_TEXT_STYLE);
+ }
+
ScopedJavaLocalRef<jobject> j_node =
Java_WebContentsImpl_createAccessibilitySnapshotNode(env,
location.x(), location.y(), node->GetScrollX(),
node->GetScrollY(), location.width(), location.height(),
- j_text.obj(), j_class.obj());
+ j_text.obj(), color, bgcolor, size, text_style, j_class.obj());
for(uint32 i = 0; i < node->PlatformChildCount(); i++) {
BrowserAccessibilityAndroid* child =

Powered by Google App Engine
This is Rietveld 408576698