diff options
author | Fabian Lange <lange.fabian@gmail.com> | 2015-03-02 11:18:23 +0100 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-03-02 12:35:54 +0000 |
commit | 6ad7ae90209b8d46271fc5dd65db3077a85f43b8 (patch) | |
tree | d85c424f2eeb6044f76db291351d4d09a4fd33f1 /client | |
parent | 251853dce1e79eceae153ff7a374533b1564abde (diff) | |
download | vaadin-framework-6ad7ae90209b8d46271fc5dd65db3077a85f43b8.tar.gz vaadin-framework-6ad7ae90209b8d46271fc5dd65db3077a85f43b8.zip |
LayoutManager reuses shortcut Element instance for measure (#16964).
This change prevents the duplicate getter chain lookup
connector.getWidget().getElement() on the very hot measureConnector
method.
Change-Id: Ia59c9ef2e6bbcf9402424bc565bc9ee3977e3c6e
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/LayoutManager.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 9775c29ab6..f77b61a5a3 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -189,8 +189,7 @@ public class LayoutManager { return element.vMeasuredSize || defaultSize; }-*/; - private final MeasuredSize getMeasuredSize(ComponentConnector connector) { - Element element = connector.getWidget().getElement(); + private final MeasuredSize getMeasuredSize(Element element) { MeasuredSize measuredSize = getMeasuredSize(element, null); if (measuredSize == null) { measuredSize = new MeasuredSize(); @@ -736,7 +735,7 @@ public class LayoutManager { private void measureConnector(ComponentConnector connector) { Profiler.enter("LayoutManager.measureConnector"); Element element = connector.getWidget().getElement(); - MeasuredSize measuredSize = getMeasuredSize(connector); + MeasuredSize measuredSize = getMeasuredSize(element); MeasureResult measureResult = measuredAndUpdate(element, measuredSize); if (measureResult.isChanged()) { @@ -1442,14 +1441,14 @@ public class LayoutManager { * of the component in pixels */ public void reportOuterHeight(ComponentConnector component, int outerHeight) { - MeasuredSize measuredSize = getMeasuredSize(component); + Element element = component.getWidget().getElement(); + MeasuredSize measuredSize = getMeasuredSize(element); if (isLayoutRunning()) { boolean heightChanged = measuredSize.setOuterHeight(outerHeight); if (heightChanged) { onConnectorChange(component, false, true); - notifyListenersAndDepdendents(component.getWidget() - .getElement(), false, true); + notifyListenersAndDepdendents(element, false, true); } currentDependencyTree.setNeedsVerticalMeasure(component, false); } else if (measuredSize.getOuterHeight() != outerHeight) { @@ -1523,14 +1522,14 @@ public class LayoutManager { * of the component in pixels */ public void reportOuterWidth(ComponentConnector component, int outerWidth) { - MeasuredSize measuredSize = getMeasuredSize(component); + Element element = component.getWidget().getElement(); + MeasuredSize measuredSize = getMeasuredSize(element); if (isLayoutRunning()) { boolean widthChanged = measuredSize.setOuterWidth(outerWidth); if (widthChanged) { onConnectorChange(component, true, false); - notifyListenersAndDepdendents(component.getWidget() - .getElement(), true, false); + notifyListenersAndDepdendents(element, true, false); } currentDependencyTree.setNeedsHorizontalMeasure(component, false); } else if (measuredSize.getOuterWidth() != outerWidth) { |