Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit 6daad9e

Browse files
authored
[Android] Change default value to from NAN to 0 (#2883)
This is a bug in default value introduced by thttps://github.com//pull/2783 ,which change some default value from 0 to Float.NAN . This commit will revert the behaviour change.
1 parent a554cd6 commit 6daad9e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static int getFontSize(Map<String, Object> style,int viewPortW) {
158158
if (style == null) {
159159
return (int) WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE,viewPortW);
160160
}
161-
int fontSize = (int) WXViewUtils.getRealPxByWidth(style.get(Constants.Name.FONT_SIZE),viewPortW);
161+
int fontSize = (int) WXViewUtils.getRealPxByWidth(style.get(Constants.Name.FONT_SIZE), 0f,viewPortW);
162162
if (fontSize <= 0) {
163163
fontSize = WXText.sDEFAULT_SIZE;
164164
}
@@ -213,7 +213,7 @@ public static int getLineHeight(Map<String, Object> style,int viewPortW){
213213
if (style == null) {
214214
return UNSET;
215215
}
216-
int lineHeight = (int)WXViewUtils.getRealPxByWidth(style.get(Constants.Name.LINE_HEIGHT),viewPortW);
216+
int lineHeight = (int)WXViewUtils.getRealPxByWidth(style.get(Constants.Name.LINE_HEIGHT), 0f,viewPortW);
217217
if (lineHeight <= 0) {
218218
lineHeight = UNSET;
219219
}

android/sdk/src/main/java/com/taobao/weex/ui/animation/TransformParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private static float parsePercentOrPx(String raw, int unit, int viewportW) {
300300
if ((suffix = raw.lastIndexOf(WXUtils.PERCENT)) != -1) {
301301
return parsePercent(raw.substring(0, suffix), unit, precision);
302302
}
303-
return WXViewUtils.getRealPxByWidth(raw,viewportW);
303+
return WXViewUtils.getRealPxByWidth(raw, 0f,viewportW);
304304

305305
}
306306

0 commit comments

Comments
 (0)