compass/src/test/testData/gems/compass-0.13.alpha.2/lib/compass/sass_extensions/functions/gradient_support.rb
def grad_position(color_list, index, default, radial = Sass::Script::Bool.new(false))
      assert_type color_list, :List
      stop = color_list.value[index.value - 1].stop
      if stop && radial.to_bool
        orig_stop = stop
        if stop.unitless?
          if stop.value <= 1
            # A unitless number is assumed to be a percentage when it's between 0 and 1
            stop = stop.times(Sass::Script::Number.new(100, ["%"]))
          else
            # Otherwise, a unitless number is assumed to be in pixels
            stop = stop.times(Sass::Script::Number.new(1, ["px"]))
          end
        end
        if stop.numerator_units == ["%"] && color_list.value.last.stop && color_list.value.last.stop.numerator_units == ["px"]
          stop = stop.times(color_list.value.last.stop).div(Sass::Script::Number.new(100, ["%"]))
        end
        Compass::Logger.new.record(:warning, "Webkit only supports pixels for the start and end stops for radial gradients. Got: #{orig_stop}") if stop.numerator_units != ["px"]
        stop.div(Sass::Script::Number.new(1, stop.numerator_units, stop.denominator_units))
      elsif stop
        stop
      else
        default
      end
    end
# given a position list, return a corresponding position in percents
# otherwise, returns the original argument
given a position list, return a corresponding position in percents
otherwise, returns the original argument
given a position list return a corresponding position in percents otherwise returns the original argument
def grad_position(color_list, index, default, radial = Sass::Script::Bool.new(false))
      assert_type color_list, :List
      stop = color_list.value[index.value - 1].stop
      if stop && radial.to_bool
        orig_stop = stop
        if stop.unitless?
          if stop.value <= 1
            stop = stop.times(Sass::Script::Number.new(100, ["%"]))
          else
            stop = stop.times(Sass::Script::Number.new(1, ["px"]))
          end
        end
        if stop.numerator_units == ["%"] && color_list.value.last.stop && color_list.value.last.stop.numerator_units == ["px"]
          stop = stop.times(color_list.value.last.stop).div(Sass::Script::Number.new(100, ["%"]))
        end
        Compass::Logger.new.record(:warning, "Webkit only supports pixels for the start and end stops for radial gradients. Got: #{orig_stop}") if stop.numerator_units != ["px"]
        stop.div(Sass::Script::Number.new(1, stop.numerator_units, stop.denominator_units))
      elsif stop
        stop
      else
        default
      end
    end
def grad_position ( color_list , index , default , radial = Sass :: Script :: Bool . new ( false ) ) assert_type color_list , :List stop = color_list . value [ index . value - 1 ] . stop if stop && radial . to_bool orig_stop = stop if stop . unitless? if stop . value <= 1 stop = stop . times ( Sass :: Script :: Number . new ( 100 , [ "%" ] ) ) else stop = stop . times ( Sass :: Script :: Number . new ( 1 , [ "px" ] ) ) end end if stop . numerator_units == [ "%" ] && color_list . value . last . stop && color_list . value . last . stop . numerator_units == [ "px" ] stop = stop . times ( color_list . value . last . stop ) . div ( Sass :: Script :: Number . new ( 100 , [ "%" ] ) ) end Compass :: Logger . new . record ( :warning , "Webkit only supports pixels for the start and end stops for radial gradients. Got: #{orig_stop}" ) if stop . numerator_units != [ "px" ] stop . div ( Sass :: Script :: Number . new ( 1 , stop . numerator_units , stop . denominator_units ) ) elsif stop stop else default end end
given a position list, return a corresponding position in percents
otherwise, returns the original argument
given a position list return a corresponding position in percents otherwise returns the original argument
# A unitless number is assumed to be a percentage when it's between 0 and 1 # Otherwise, a unitless number is assumed to be in pixels
color_list
index
default
radial
new