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

Unified Diff: ui/android/java/src/org/chromium/ui/resources/LayoutResource.java

Issue 2746483003: ui/android: Fix Resource meta-data sharing with ResourceManager. (Closed)
Patch Set: jni Created 3 years, 9 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 | « ui/android/BUILD.gn ('k') | ui/android/java/src/org/chromium/ui/resources/Resource.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/resources/LayoutResource.java
diff --git a/ui/android/java/src/org/chromium/ui/resources/LayoutResource.java b/ui/android/java/src/org/chromium/ui/resources/LayoutResource.java
index 47e3f1f69bcef1fa17c127a63fe2e2340895c63a..dd3b12fc1b7c6e43fcd3613fd9d85908097c5a85 100644
--- a/ui/android/java/src/org/chromium/ui/resources/LayoutResource.java
+++ b/ui/android/java/src/org/chromium/ui/resources/LayoutResource.java
@@ -7,6 +7,8 @@ package org.chromium.ui.resources;
import android.graphics.Rect;
import android.graphics.RectF;
+import org.chromium.ui.resources.statics.NinePatchData;
+
/**
* A resource that provides sizing information for layouts.
*/
@@ -16,9 +18,14 @@ public class LayoutResource {
private final RectF mAperture;
public LayoutResource(float pxToDp, Resource resource) {
- Rect padding = resource.getPadding();
+ Rect padding = new Rect();
+ Rect aperture = new Rect();
+ NinePatchData ninePatchData = resource.getNinePatchData();
+ if (ninePatchData != null) {
+ padding = ninePatchData.getPadding();
+ aperture = ninePatchData.getAperture();
+ }
Rect bitmapSize = resource.getBitmapSize();
- Rect aperture = resource.getAperture();
mPadding = new RectF(padding.left * pxToDp, padding.top * pxToDp, padding.right * pxToDp,
padding.bottom * pxToDp);
@@ -32,8 +39,7 @@ public class LayoutResource {
/**
* @return The padded content area of this resource in dp. For 9-patches this will represent
- * the valid content of the 9-patch. It can mean other things for other Resources
- * though.
+ * the valid content of the 9-patch. In all other cases, it will be an empty rect.
*/
public RectF getPadding() {
return mPadding;
@@ -48,8 +54,8 @@ public class LayoutResource {
/**
* @return The aperture of this resource in dp. For 9-patches this will represent the area of
- * the {@link Bitmap} that should not be stretched. It can mean other things for other
- * Resources though.
+ * the {@link Bitmap} that should not be stretched. In all other cases, it will be an
+ * empty rect.
*/
public RectF getAperture() {
return mAperture;
« no previous file with comments | « ui/android/BUILD.gn ('k') | ui/android/java/src/org/chromium/ui/resources/Resource.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698