Bug 148584

Summary: Miscalculated Viewport Width and Height (vw/vh) inside iframe
Product: WebKit Reporter: Marvin Danig <marvin>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Major CC: bdakin, benjamin, hyatt
Priority: P2 Keywords: HTML5
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: All   

Description Marvin Danig 2015-08-28 13:09:38 PDT

I've the nightly build on my iPad and an older version of iOS too, so I'm assuming this bug has been there for long (Thus the risk of repeating the issue, but I didn't find it). 

Seems like `vw` and `vh` units are miscalculated inside of an iframe each time you change the orientation of the device. Happens both on iPhone & iPad.  

Here's the test case and it's <a href="https://bubbl.in/book/official-handbook-by-marvin-danig/4">live demo</a>:



    // style here.

    <div class="leaf">
      <div class="inner">
          “To teach how to live without certainty, and yet without being paralyzed by hesitation, is perhaps the chief thing that philosophy, in our age, can still do for those who study it.”

          <div class="right">
            <p>- Bertrand Russell, </p>
              <a href="https://archive.org/stream/westernphilosoph035502mbp/westernphilosoph035502mbp_djvu.txt">A History of Western Philosophy</a>




@import url(//fonts.googleapis.com/css?family=EB+Garamond);
body {
  margin: 0 0;
  overflow: hidden;
  color: #fff;
  font-size: 3.5vw;
  font-family: 'EB Garamond', serif;
  background-image: url(//raw.githubusercontent.com/bubblin/Official-Handbook/master/images/bertrand-page-5.jpg);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  height: 100vh;
  width: 100vw;

.inner {
  width: 70vw;
  float: right;
  padding: 3vw;

cite {
  font-style: oblique;
  font-size: 3vw;

.right {
  float: right;

a {
  color: #00ffaa;
  outline: 0 none;
  text-decoration: none;
  text-rendering: optimizelegibility;

a:hover {
  outline: 0 none;
  text-shadow: 0 0 2px #0cf;

a:active {
  padding-top: 2px;

Now if you change the orientation of the screen it appears that iOS continues to calculate the vw/vh even after rendering the oversized context. Or it calculates the viewport width and height before the iframe itself is given its final reoriented size.
Comment 1 Marvin Danig 2015-09-15 13:27:11 PDT
URL of the test/live case is here now: