mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-04 22:56:32 +08:00
Add override for debug warning highlights for non-performant views and commands.
Summary: Adds a flag that can be set in FlatViewGroup to see known performance issues in Nodes objects. This is mostly useful in internal development of Nodes, and will be a dead code path when not set. Reviewed By: ahmedre Differential Revision: D3732675
This commit is contained in:
committed by
Ahmed El-Helw
parent
4a12efad02
commit
d601cc084b
@@ -201,7 +201,35 @@ import android.graphics.RectF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debugDraw(FlatViewGroup parent, Canvas canvas) {
|
||||
protected void onDebugDraw(FlatViewGroup parent, Canvas canvas) {
|
||||
parent.debugDrawNextChild(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDebugDrawHighlight(Canvas canvas) {
|
||||
if (mPath != null) {
|
||||
debugDrawWarningHighlight(canvas, "borderRadius: " + mClipRadius);
|
||||
} else if (!boundsMatch(mLogicalLeft, mLogicalTop, mLogicalRight, mLogicalBottom)) {
|
||||
StringBuilder warn = new StringBuilder("Overflow: { ");
|
||||
String[] names = { "left: ", "top: ", "right: ", "bottom: "};
|
||||
int i = 0;
|
||||
float[] offsets = new float[4];
|
||||
offsets[i++] = getLeft() - mLogicalLeft;
|
||||
offsets[i++] = getTop() - mLogicalTop;
|
||||
offsets[i++] = mLogicalRight - getRight();
|
||||
offsets[i++] = mLogicalBottom - getBottom();
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (offsets[i] != 0f) {
|
||||
warn.append(names[i]);
|
||||
warn.append(offsets[i]);
|
||||
warn.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
warn.append("}");
|
||||
|
||||
debugDrawCautionHighlight(canvas, warn.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user