docs: function(sortedInputEvents) {
        var protoIRs = [];
        var currentPIR = undefined;
        var sawFirstUpdate = false;
        forEventTypesIn(sortedInputEvents, SCROLL_TYPE_NAMES, function(event) {
          switch (event.typeName) {
            case INPUT_TYPE.SCROLL_BEGIN:
              // Always begin a new PIR even if there already is one, unlike
              // PinchBegin.
              currentPIR = new ProtoIR(ProtoIR.RESPONSE_TYPE, SCROLL_IR_NAME);
              currentPIR.pushEvent(event);
              protoIRs.push(currentPIR);
              sawFirstUpdate = false;
              break;
  
            case INPUT_TYPE.SCROLL_UPDATE:
              if (currentPIR) {
                if (currentPIR.isNear(event, INPUT_MERGE_THRESHOLD_MS) &&
                    ((currentPIR.irType === ProtoIR.ANIMATION_TYPE) ||
                    !sawFirstUpdate)) {
                  currentPIR.pushEvent(event);
                  sawFirstUpdate = true;
                } else {
                  currentPIR = new ProtoIR(ProtoIR.ANIMATION_TYPE,
                      SCROLL_IR_NAME);
                  currentPIR.pushEvent(event);
                  protoIRs.push(currentPIR);
                }
              } else {
                // ScrollUpdate without ScrollBegin.
                currentPIR = new ProtoIR(ProtoIR.ANIMATION_TYPE, SCROLL_IR_NAME);
                currentPIR.pushEvent(event);
                protoIRs.push(currentPIR);
              }
              break;
  
            case INPUT_TYPE.SCROLL_END:
              if (!currentPIR) {
                console.error('ScrollEnd without ScrollUpdate? ' +
                              'File a bug with this trace!');
                var pir = new ProtoIR(ProtoIR.IGNORED_TYPE);
                pir.pushEvent(event);
                protoIRs.push(pir);
                break;
              }
              currentPIR.pushEvent(event);
              break;
          }
        });
        return protoIRs;
      }