FLEX-33830 HScrollbar should defer some work to the validation methods otherwise it will get incorrect metrics
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/24c1d8f0 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/24c1d8f0 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/24c1d8f0 Branch: refs/heads/develop Commit: 24c1d8f019974841aaf5558ce423dcdb5752b708 Parents: 3e752d9 Author: Alex Harui <[email protected]> Authored: Fri Oct 18 12:43:26 2013 -0700 Committer: Alex Harui <[email protected]> Committed: Fri Oct 18 12:43:26 2013 -0700 ---------------------------------------------------------------------- .../spark/src/spark/components/HScrollBar.as | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/24c1d8f0/frameworks/projects/spark/src/spark/components/HScrollBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/HScrollBar.as b/frameworks/projects/spark/src/spark/components/HScrollBar.as index 90d3aa3..ca8d456 100644 --- a/frameworks/projects/spark/src/spark/components/HScrollBar.as +++ b/frameworks/projects/spark/src/spark/components/HScrollBar.as @@ -160,6 +160,8 @@ public class HScrollBar extends ScrollBarBase // //-------------------------------------------------------------------------- + private var maxAndPageSizeInvalid:Boolean = false; + private function updateMaximumAndPageSize():void { var hsp:Number = viewport.horizontalScrollPosition; @@ -532,11 +534,29 @@ public class HScrollBar extends ScrollBarBase if (allStyles || styleName == "interactionMode") { if (viewport) - updateMaximumAndPageSize(); + { + // Some of the information needed + // is calculated in measure() on a child + maxAndPageSizeInvalid = true; + invalidateSize(); + } } } /** + * @private + */ + override protected function measure():void + { + super.measure(); + if (maxAndPageSizeInvalid) + { + maxAndPageSizeInvalid = false; + updateMaximumAndPageSize(); + } + } + + /** * @private * Scroll horizontally by event.delta "steps". This listener is added to the viewport * at a lower priority then the vertical scrollbar mouse wheel listener, so that vertical
