<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Spurious resize events fired when resuming device"
   href="https://bugs.webkit.org/show_bug.cgi?id=154816">154816</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Spurious resize events fired when resuming device
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari 9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>iOS
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>iOS 9.2
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>HTML Events
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ashley&#64;scirra.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>URL: <a href="http://www.scirra.com/labs/bugs/iosviewport/resume.html">http://www.scirra.com/labs/bugs/iosviewport/resume.html</a>

Steps to reproduce:
1. Visit the given URL in portrait orientation.
(note: it may start up with the wrong display due to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Viewport changes after refresh"
   href="show_bug.cgi?id=154815">bug 154815</a>)
2. Press the device power button to put it to sleep. Do not change its orientation until waking it up again.
3. Wake it up again and unlock it.
4. Note the events listed in Safari.

Observed result:
Safari fires spurious resize events. E.g. it will log something like (on an iPad Air 2):

Startup: 980 x 1225 [note probably incorrect due to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Viewport changes after refresh"
   href="show_bug.cgi?id=154815">bug 154815</a>]
visibilitychange event (hidden): 768 x 960
resize event: 1024 x 704
orientationchange event: 1024 x 704
resize event: 768 x 960
orientationchange event: 768 x 960
visibilitychange event (visible): 768 x 960

Note these events fire resize/orientationchange for landscape orientation followed immediately by portrait orientation upon waking. This is misleading since the device did not really change size or orientation.

Note the same happens in landscape orientation, but it first fires events for portrait orientation followed by landscape orientation.

Expected result:
No spurious events, e.g. a log similar to:

Startup: 768 x 960
visibilitychange event (hidden): 768 x 960
visibilitychange event (visible): 768 x 960

or alternatively, a single resize event that indicates the same size again like this:

Startup: 768 x 960
visibilitychange event (hidden): 768 x 960
resize event: 768 x 960
orientationchange event: 768 x 960
visibilitychange event (visible): 768 x 960</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>