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

Side by Side Diff: content/browser/web_contents/web_contents_android.cc

Issue 2443353003: The Android ViewStructure font size should be in physical pixels (Closed)
Patch Set: Address feedback Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_android.h" 5 #include "content/browser/web_contents/web_contents_android.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // they are not. Use a negative size information to indicate the existence 99 // they are not. Use a negative size information to indicate the existence
100 // of style information. 100 // of style information.
101 float size = -1.0; 101 float size = -1.0;
102 int color = 0; 102 int color = 0;
103 int bgcolor = 0; 103 int bgcolor = 0;
104 int text_style = 0; 104 int text_style = 0;
105 105
106 if (node->HasFloatAttribute(ui::AX_ATTR_FONT_SIZE)) { 106 if (node->HasFloatAttribute(ui::AX_ATTR_FONT_SIZE)) {
107 color = node->GetIntAttribute(ui::AX_ATTR_COLOR); 107 color = node->GetIntAttribute(ui::AX_ATTR_COLOR);
108 bgcolor = node->GetIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR); 108 bgcolor = node->GetIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR);
109 text_style = node->GetIntAttribute(ui::AX_ATTR_TEXT_STYLE);
110
111 // The font size is just the computed style for that element; apply
112 // transformations to get the actual pixel size.
109 size = node->GetFloatAttribute(ui::AX_ATTR_FONT_SIZE); 113 size = node->GetFloatAttribute(ui::AX_ATTR_FONT_SIZE);
boliu 2016/10/25 17:20:19 nit: can you pass this directly into RectF constru
dmazzoni 2016/10/25 17:31:16 Done.
110 text_style = node->GetIntAttribute(ui::AX_ATTR_TEXT_STYLE); 114 gfx::RectF text_size_rect(0, 0, 1, size);
115 gfx::Rect scaled_text_size_rect = node->RelativeToAbsoluteBounds(
116 text_size_rect, false);
117 size = scaled_text_size_rect.height();
111 } 118 }
112 119
113 const gfx::Rect& absolute_rect = node->GetPageBoundsRect(); 120 const gfx::Rect& absolute_rect = node->GetPageBoundsRect();
114 gfx::Rect parent_relative_rect = absolute_rect; 121 gfx::Rect parent_relative_rect = absolute_rect;
115 bool is_root = node->GetParent() == nullptr; 122 bool is_root = node->GetParent() == nullptr;
116 if (!is_root) { 123 if (!is_root) {
117 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); 124 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin());
118 } 125 }
119 ScopedJavaLocalRef<jobject> j_node = 126 ScopedJavaLocalRef<jobject> j_node =
120 Java_WebContentsImpl_createAccessibilitySnapshotNode( 127 Java_WebContentsImpl_createAccessibilitySnapshotNode(
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 Java_WebContentsImpl_addToBitmapList(env, jbitmaps, jbitmap); 734 Java_WebContentsImpl_addToBitmapList(env, jbitmaps, jbitmap);
728 } 735 }
729 for (const gfx::Size& size : sizes) { 736 for (const gfx::Size& size : sizes) {
730 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(), 737 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(),
731 size.height()); 738 size.height());
732 } 739 }
733 Java_WebContentsImpl_onDownloadImageFinished( 740 Java_WebContentsImpl_onDownloadImageFinished(
734 env, *obj, *callback, id, http_status_code, jurl, jbitmaps, jsizes); 741 env, *obj, *callback, id, http_status_code, jurl, jbitmaps, jsizes);
735 } 742 }
736 } // namespace content 743 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698