Oh, sorry I didn't make it clear.  By test I think we should not use
(max-device-aspect-ratio: 1/1) representing portrait mode and
(min-device-aspect-ratio: 1/1) representing landscape mode because (orientation: xxx) is decided by iframe.width / iframe.height which is not what we want.
(see my comment 17 in bug 830644)

I'm OK on other codes.  Thank you!