<commit_before>////////////////////////////////////////////////////////////////////////////////
//  ADOBE SYSTEMS INCORPORATED
//  Copyright 2008 Adobe Systems Incorporated
//  All Rights Reserved.
//
//  NOTICE: Adobe permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////


package spark.components.supportClasses
{
import flash.geom.Point;

import mx.core.IUIComponent;
import mx.core.ScrollPolicy;
import mx.utils.MatrixUtil;

import spark.components.Scroller;
import spark.core.IViewport;
import spark.layouts.supportClasses.LayoutBase;

[ExcludeClass]

/**
 *  @private
 */
public class ScrollerLayout extends LayoutBase
{
    public function ScrollerLayout()    
    {
        super();
    }

    /**
     *  @private
     *  SDT - Scrollbar Display Threshold.  If the content size exceeds the
     *  viewport's size by SDT, then we show a scrollbar.  For example, if the 
     *  contentWidth >= viewport width + SDT, show the vertical scrollbar.
     */
    private static const SDT:Number = 1.0;

    /**
     *  @private
     *  Used by updateDisplayList() to prevent looping.
     */
    private var invalidationCount:int = 0;
    
    
    /**
     *  @private
     */
    private function getScroller():Scroller
    {
        var g:Skin = target as Skin;
        return (g && ("hostComponent" in g)) ? Object(g).hostComponent as Scroller : null;
    }

    /**
     *  @private
     *  Returns the viewport's content size transformed into the Scroller's coordiante
     *  system.   This makes it possible to compare the viewport size (also reported
     *  relative to the Scroller) and the content size when a transform has been applied
     *  to the viewport.  See http://bugs.adobe.com/jira/browse/SDK-19702
     */
    private function getLayoutContentSize(viewport:IViewport):Point
    {
        // TODO(hmuller):prefer to do nothing if transform doesn't change size, see UIComponent/nonDeltaLayoutMatrix()
        var cw:Number = viewport.contentWidth;
        var ch:Number = viewport.contentHeight;
        if ((cw == 0) && (ch == 0))
            return new Point(0,0);
        return MatrixUtil.transformSize(new Point(cw, ch), viewport.getLayoutMatrix());
    }

    //----------------------------------
    //  hsbVisible
    //----------------------------------    
    
    private var hsbScaleX:Number = 1;
    private var hsbScaleY:Number = 1;

    /**
     *  @private
     */<commit_msg>Transferred from the Adobe Open Source Subversion Repository<commit_after>////////////////////////////////////////////////////////////////////////////////
//  ADOBE SYSTEMS INCORPORATED
//  Copyright 2008 Adobe Systems Incorporated
//  All Rights Reserved.
//
//  NOTICE: Adobe permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////


package spark.components.supportClasses
{
import flash.geom.Point;

import mx.core.IUIComponent;
import mx.core.ScrollPolicy;
import mx.utils.MatrixUtil;

import spark.components.Scroller;
import spark.core.IViewport;
import spark.layouts.supportClasses.LayoutBase;

[ExcludeClass]

/**
 *  @private
 */
public class ScrollerLayout extends LayoutBase
{
    public function ScrollerLayout()    
    {
        super();
    }

    /**
     *  @private
     *  SDT - Scrollbar Display Threshold.  If the content size exceeds the
     *  viewport's size by SDT, then we show a scrollbar.  For example, if the 
     *  contentWidth >= viewport width + SDT, show the horizontal scrollbar.
     */
    private static const SDT:Number = 1.0;

    /**
     *  @private
     *  Used by updateDisplayList() to prevent looping.
     */
    private var invalidationCount:int = 0;
    
    
    /**
     *  @private
     */
    private function getScroller():Scroller
    {
        var g:Skin = target as Skin;
        return (g && ("hostComponent" in g)) ? Object(g).hostComponent as Scroller : null;
    }

    /**
     *  @private
     *  Returns the viewport's content size transformed into the Scroller's coordiante
     *  system.   This makes it possible to compare the viewport size (also reported
     *  relative to the Scroller) and the content size when a transform has been applied
     *  to the viewport.  See http://bugs.adobe.com/jira/browse/SDK-19702
     */
    private function getLayoutContentSize(viewport:IViewport):Point
    {
        // TODO(hmuller):prefer to do nothing if transform doesn't change size, see UIComponent/nonDeltaLayoutMatrix()
        var cw:Number = viewport.contentWidth;
        var ch:Number = viewport.contentHeight;
        if (((cw == 0) && (ch == 0)) || (isNaN(cw) || isNaN(ch)))
            return new Point(0,0);
        return MatrixUtil.transformSize(new Point(cw, ch), viewport.getLayoutMatrix());
    }

    //----------------------------------
    //  hsbVisible
    //----------------------------------    
    
    private var hsbScaleX:Number = 1;
    private var hsbScaleY:Number = 1;

    /**
     *  @private
     */
{'fraction_non_alphanumeric': 0.17650429799426934, 'fraction_numerical': 0.006876790830945559, 'mean_word_length': 1.9284116331096197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3023748', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1418, 'n_words': 433}