The state of the flip flop is not known until the first trailing
edge. At that point, D determines what is to be stored. Thus,
the first time, Q goes to 1; the second time, Q goes to 0; the
third time, Q goes to (stays at) 0. When D changes between
clock times, that does not affect the behavior; it is the value
just before the trailing edge that matters.