Suppose the market is $50.00 x $50.15 with a size of 10,000 x 1,000. That means that buyers are bidding to buy 10,000 shares at $50.00 and sellers are offering 1,000 shares at $50.15
What happens now? Will price rise or will it drop? That all depends on who crosses the market and for how many shares.
Suppose I come along and I sell 2,000 shares at the bid. The quote now becomes $50.00 x $50.15 with a size of 8,000 x 1,000 (assuming no new orders come in at current price). If the previous trade was at $50.00 then price is unchanged.
Suppose you come along and you buy 1,000 shares at the ask price of $50.15, taking out all shares offered at that price (and no new orders come in at $50.15 or better). The ask price now moves up to the next order on the order book, say 500 shares at $50.25.
If no buyers raise their bid, the quote becomes $50.00 x $50.25 with a size of 8,000 x 500. However, in general, as the ask price moves up, bids tend to be increased as buyers raise their buy prices.
The net result? 2,000 shares traded at the bid and 1,000 shares traded at the ask and yet price increased (last trade as well as the ask price).