Skip to content

Commit 2c8bc0c

Browse files
committed
[BugFix][Android] Override onMeasure in UIBodyView to delegate measurement to renderer
- What changed Added an onMeasure override in UIBody.UIBodyView. When shouldDrawWithDisplayList() returns true, measurement is delegating to the renderer's measure method instead of using the default View onMeasure behavior. - Why it was needed In fragment layer / display list render mode, letting the default View onMeasure run could override the measured dimensions set by the renderer and lead to incorrect layout or extra measure passes. - How it was verified / impacts This change keeps onMeasure consistent with the existing onLayout and onDraw renderer delegation paths and avoids redundant measurement work in display-list mode. [internal] TEST: existing Android unit tests and LynxExample verification [end-internal]
1 parent ec14f94 commit 2c8bc0c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • platform/android/lynx_android/src/main/java/com/lynx/tasm/behavior/ui

platform/android/lynx_android/src/main/java/com/lynx/tasm/behavior/ui/UIBody.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,16 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
732732
}
733733
}
734734

735+
@Override
736+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
737+
if (shouldDrawWithDisplayList()) {
738+
// Do not call super here, which will overrides the measured dimension.
739+
getRenderer().onMeasure(widthMeasureSpec, heightMeasureSpec);
740+
} else {
741+
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
742+
}
743+
}
744+
735745
@Override
736746
protected void onDraw(Canvas canvas) {
737747
super.onDraw(canvas);

0 commit comments

Comments
 (0)