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

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

Issue 2443353003: The Android ViewStructure font size should be in physical pixels (Closed)
Patch Set: Reword Android pixels to physical pixels Created 4 years, 2 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 054aaffdaf89e1223c51cbe97b0bc4d8f44091b4..35ca728e3690cba485f4c1b78d803485777e0513 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -106,8 +106,15 @@ ScopedJavaLocalRef<jobject> WalkAXTreeDepthFirst(
if (node->HasFloatAttribute(ui::AX_ATTR_FONT_SIZE)) {
color = node->GetIntAttribute(ui::AX_ATTR_COLOR);
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);
+
+ // The font size is just the computed style for that element; apply
+ // transformations to get the actual pixel size.
+ gfx::RectF text_size_rect(
+ 0, 0, 1, node->GetFloatAttribute(ui::AX_ATTR_FONT_SIZE));
+ gfx::Rect scaled_text_size_rect = node->RelativeToAbsoluteBounds(
+ text_size_rect, false);
+ size = scaled_text_size_rect.height();
}
const gfx::Rect& absolute_rect = node->GetPageBoundsRect();

Powered by Google App Engine
This is Rietveld 408576698