Cache result to fix WebKit framerate issue

When tied to an onresize event, for example, the code can cause significant frame-rate performance issues in Webkit browsers such as Chrome. This is due to the repeated insertion and deletion of elements to the DOM to calculate which value is the "true viewport value". This change caches the result of the calculation so it is faster on subsequent calls.