If a viewport-tag is found we replace the first one with the viewport-tag we want. However, this viewport-tag can actually be in the part of the message that is removed. This results in that the part of the message that is rendered does not contain the viewport-tag causing the scaling to be off.
Example input.
<div>
<p>Forwarding you a message</p>
<blockquote class="gmail_quote">
<meta name="viewport" content="width=device-width">
<div>blabla</div>
</blockqoute>
<div>
Result (missing the viewport-tag)
<div>
<p>Forwarding you a message</p>
<div>
Result we want
<div>
<meta name="viewport" content="width=device-width">
<p>Forwarding you a message</p>
<div>
Another solution to the one I have committed is to move the enforceViewport call in prepareMessage to after we have done all removals.
If a viewport-tag is found we replace the first one with the viewport-tag we want. However, this viewport-tag can actually be in the part of the message that is removed. This results in that the part of the message that is rendered does not contain the viewport-tag causing the scaling to be off.
Example input.
Result (missing the viewport-tag)
Result we want
Another solution to the one I have committed is to move the
enforceViewport
call inprepareMessage
to after we have done all removals.