mixins: optimize widget isHidden and getParent
This commit is contained in:
@@ -119,6 +119,13 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
return rsParentId;
|
return rsParentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int id = getId();
|
||||||
|
if (TO_GROUP(id) == client.getWidgetRoot())
|
||||||
|
{
|
||||||
|
// this is a root widget
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int parentId = rl$parentId;
|
int parentId = rl$parentId;
|
||||||
if (parentId != -1)
|
if (parentId != -1)
|
||||||
{
|
{
|
||||||
@@ -130,7 +137,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
// check the parent in the component table
|
// check the parent in the component table
|
||||||
HashTable<WidgetNode> componentTable = client.getComponentTable();
|
HashTable<WidgetNode> componentTable = client.getComponentTable();
|
||||||
WidgetNode widgetNode = componentTable.get(parentId);
|
WidgetNode widgetNode = componentTable.get(parentId);
|
||||||
if (widgetNode == null || widgetNode.getId() != TO_GROUP(getId()))
|
if (widgetNode == null || widgetNode.getId() != TO_GROUP(id))
|
||||||
{
|
{
|
||||||
// invalidate parent
|
// invalidate parent
|
||||||
rl$parentId = -1;
|
rl$parentId = -1;
|
||||||
@@ -191,6 +198,11 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
@Override
|
@Override
|
||||||
public boolean isHidden()
|
public boolean isHidden()
|
||||||
{
|
{
|
||||||
|
if (isSelfHidden())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Widget parent = getParent();
|
Widget parent = getParent();
|
||||||
|
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
@@ -208,7 +220,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isSelfHidden();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
Reference in New Issue
Block a user