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..4c9b96182603b313c415dbf35a89e0abddcda262 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.StaticResource; |
+ |
/** |
* 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) { |
David Trainor- moved to gerrit
2017/03/14 18:31:52
Can we add a resource.buildLayoutResource(float px
Khushal
2017/03/15 01:50:06
Here as well, how about a final NinePatchData getN
Khushal
2017/03/16 19:01:44
Done.
|
- Rect padding = resource.getPadding(); |
+ Rect padding = new Rect(); |
+ Rect aperture = new Rect(); |
+ if (resource instanceof StaticResource) { |
+ StaticResource staticResource = (StaticResource) resource; |
+ padding = staticResource.getPadding(); |
+ aperture = staticResource.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; |