Not all dogs yawn when they're petted. Some dogs may yawn as a way to show that they're relaxed and enjoying the attention, while others may not yawn at all. It's important to pay attention to other body language cues, such as wagging tails or relaxed body posture, to determine how a dog is feeling when they're being petted.