Ticket #3961: lang-fx-reduction.patch

File lang-fx-reduction.patch, 6.5 kB (added by peller, 14 months ago)

Remove fx defaultEasing hack for old Konqueror (fixed in 3.5.5, according to mumme) Also remove unneeded instance defaults on prototype, other style and size changes

  • Users/peller/workspace/trunk2/dojo/_base/fx.js

     
    3636        }, 
    3737         
    3838        // public properties 
    39         curve: null, 
     39//      curve: null, 
    4040        duration: 1000, 
    41         easing: null, 
     41//      easing: null, 
    4242        repeat: 0, 
    4343        rate: 10, // 100 fps 
     44 
     45/*===== 
    4446        delay: null, 
    45          
     47 
    4648        // events 
    4749        beforeBegin: null, 
    4850        onBegin: null, 
     
    5153        onPlay: null, 
    5254        onPause: null, 
    5355        onStop: null, 
     56=====*/ 
    5457 
    5558        // private properties 
    56         _active: false, 
    57         _paused: false, 
    58         _startTime: null, 
    59         _endTime: null, 
    60         _timer: null, 
     59//      _active: false, 
     60//      _paused: false, 
     61//      _startTime: null, 
     62//      _endTime: null, 
     63//      _timer: null, 
    6164        _percent: 0, 
    6265        _startRepeatCount: 0, 
    6366 
     
    125128                return this; // dojo._Animation 
    126129        }, 
    127130 
    128         gotoPercent: function(/*Decimal*/ pct, /*boolean?*/ andPlay){ 
     131        gotoPercent: function(/*Decimal*/ percent, /*boolean?*/ andPlay){ 
    129132                // summary: Sets the progress of the animation. 
    130                 // pct: A percentage in decimal notation (between and including 0.0 and 1.0). 
     133                // percent: A percentage in decimal notation (between and including 0.0 and 1.0). 
    131134                // andPlay: If true, play the animation after setting the progress. 
    132135                clearTimeout(this._timer); 
    133136                this._active = this._paused = true; 
    134                 this._percent = pct * 100; 
     137                this._percent = percent * 100; 
    135138                if(andPlay){ this.play(); } 
    136139                return this; // dojo._Animation 
    137140        }, 
     
    222225        } 
    223226 
    224227        dojo._fade = function(/*Object*/ args){ 
    225                 // summary:Returns an animation that will fade the "nodes" from the start to end values passed. 
     228                // summary: Returns an animation that will fade the "nodes" from the start to end values passed (end is mandatory) 
    226229 
    227                 //FIXME: remove arg checking?  Change docs above to show that end is not optional.  Just make sure this blows up in a reliable way? 
    228                 if(typeof args.end == "undefined"){ 
    229                         throw new Error("dojo._fade needs an end value"); 
    230                 } 
    231230                args.node = dojo.byId(args.node); 
    232231                var fArgs = dojo.mixin({ properties: {} }, args); 
    233232                var props = (fArgs.properties.opacity = {}); 
     
    264263                return dojo._fade(dojo.mixin({ end: 0 }, args)); // dojo._Animation 
    265264        } 
    266265 
    267         if(dojo.isKhtml && !dojo.isSafari){ 
    268                 // the cool kids are obviously not using konqueror... 
    269                 // found a very wierd bug in floats constants, 1.5 evals as 1 
    270                 // seems somebody mixed up ints and floats in 3.5.4 ?? 
    271                 // FIXME: investigate more and post a KDE bug (Fredrik) 
    272                 dojo._defaultEasing = function(/*Decimal?*/ n){ 
    273                         //      summary: Returns the point for point n on a sin wave. 
    274                         return parseFloat("0.5")+((Math.sin((n+parseFloat("1.5")) * Math.PI))/2); //FIXME: Does this still occur in the supported Safari version? 
    275                 } 
    276         }else{ 
    277                 dojo._defaultEasing = function(/*Decimal?*/ n){ 
    278                         return 0.5+((Math.sin((n+1.5) * Math.PI))/2); 
    279                 } 
     266        dojo._defaultEasing = function(/*Decimal?*/ n){ 
     267                return 0.5 + ((Math.sin((n + 1.5) * Math.PI))/2); 
    280268        } 
    281269 
    282270        var PropLine = function(properties){ 
     
    292280                        var ret = {}; 
    293281                        for(var p in this._properties){ 
    294282                                var prop = this._properties[p]; 
    295                                 var value = null; 
    296                                 if(prop.start instanceof dojo.Color){ 
    297                                         value = dojo.blendColors(prop.start, prop.end, r, prop.tempColor).toCss(); 
    298                                 }else if(!dojo.isArray(prop.start)){ 
    299                                         value = ((prop.end - prop.start) * r) + prop.start + (p != "opacity" ? prop.units||"px" : ""); 
     283                                var start = prop.start; 
     284                                if(start instanceof dojo.Color){ 
     285                                        ret[p] = dojo.blendColors(start, prop.end, r, prop.tempColor).toCss(); 
     286                                }else if(!dojo.isArray(start)){ 
     287                                        ret[p] = ((prop.end - start) * r) + start + (p != "opacity" ? prop.units||"px" : ""); 
    300288                                } 
    301                                 ret[p] = value; 
    302289                        } 
    303290                        return ret; 
    304291                } 
     
    309296                // defined in 'args' depending how they are defined in 'args.properties' 
    310297 
    311298                args.node = dojo.byId(args.node); 
    312                 if (!args.easing){ args.easing = dojo._defaultEasing; } 
    313                  
     299                if(!args.easing){ args.easing = dojo._defaultEasing; } 
     300 
    314301                var anim = new dojo._Animation(args); 
    315302                dojo.connect(anim, "beforeBegin", anim, function(){ 
    316303                        var pm = {}; 
     
    318305                                // Make shallow copy of properties into pm because we overwrite some values below. 
    319306                                // In particular if start/end are functions we don't want to overwrite them or 
    320307                                // the functions won't be called if the animation is reused. 
    321                                 var prop = pm[p] = dojo.mixin({}, this.properties[p]); 
     308                                var prop = (pm[p] = dojo.mixin({}, this.properties[p])); 
    322309 
    323310                                if(dojo.isFunction(prop.start)){ 
    324311                                        prop.start = prop.start(); 
  • Users/peller/workspace/trunk2/dojo/_base/lang.js

     
    33// Crockford functions (ish) 
    44 
    55dojo.isString = function(/*anything*/ it){ 
    6         // summary:     Return true if it is a String. 
     6        // summary:     Return true if it is a String 
    77        return typeof it == "string" || it instanceof String; // Boolean 
    88} 
    99 
    1010dojo.isArray = function(/*anything*/ it){ 
    11         // summary: Return true of it is an Array 
     11        // summary: Return true if it is an Array 
    1212        return it && it instanceof Array || typeof it == "array" || 
    13                 ((typeof dojo.NodeList != "undefined") && (it instanceof dojo.NodeList)); // Boolean 
     13                (typeof dojo.NodeList != "undefined" && it instanceof dojo.NodeList); // Boolean 
    1414} 
    1515 
    16 if(dojo.isBrowser && dojo.isSafari){ 
    17         // only slow this down w/ gratuitious casting in Safari since it's what's b0rken 
    18         dojo.isFunction = function(/*anything*/ it){ 
    19                 if(typeof it == "function" && it == "[object NodeList]"){ return false; } 
    20                 return typeof it == "function" || it instanceof Function; // Boolean 
    21         } 
    22 }else{ 
    23         dojo.isFunction = function(/*anything*/ it){ 
    24                 return typeof it == "function" || it instanceof Function; // Boolean 
    25         } 
     16/*===== 
     17dojo.isFunction = function(it){ 
     18        // summary: Return true if it is a Function 
     19        // it: anything 
    2620} 
     21=====*/ 
    2722 
     23dojo.isFunction = (function(){ 
     24        var _isFunction = function(/*anything*/ it){ 
     25                return typeof it == "function" || it instanceof Function; // Boolean 
     26        }; 
     27 
     28        return dojo.isSafari ? 
     29                // only slow this down w/ gratuitious casting in Safari since it's what's b0rken 
     30                function(/*anything*/ it){ 
     31                        if(typeof it == "function" && it == "[object NodeList]"){ return false; } 
     32                        return _isFunction(it); // Boolean 
     33                } : _isFunction; 
     34})(); 
     35 
    2836dojo.isObject = function(/*anything*/ it){ 
    2937        // summary:  
    3038        //              Returns true if it is a JavaScript object (or an Array, a Function or null)