Skip to content
  • Emilio Cobos Álvarez's avatar
    Bug 1551659 - Remove MVMContext::ResizeEventFlag and related code. r=botond,hiro · 161cb16c
    Emilio Cobos Álvarez authored
    D46944 / bug 1583534 is what fixes the root cause of bug 1528052 by not
    having the first call to ResizeReflow have a wrong old size of 0x0.
    
    This removes the code that bug introduces to suppress resize events, which
    fixes this bug. I think our behavior now is pretty sane.
    
    In particular, consider the test-case:
    
    <!doctype html>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <a href="" target="_blank">Open me in a separate tab</a>
    <pre id="log"></pre>
    <script>
      // This shouldn't be needed, but otherwise Fenix doesn't show the tooltip on
      // longpress...
      document.querySelector("a").href = location.href;
    
      function logSize() {
        log.innerText += window.innerWidth + "x" + window.innerHeight + "\n";
      }
      logSize();
      onresize = logSize;
    </script>
    
    (Hosted at https://crisal.io/tmp/gecko-mobile-resize.html for convenience)
    
    Right now on trunk, when you click the link from GVE or Fenix, we're only
    getting an initial size of 0x0 (which is not great, btw), and only after first
    paint we get the real device size, but content doesn't get a resize event.
    
    This is obviously wrong, every time the layout viewport changes we should fire
    resize events.
    
    Pages that get opened in new tabs and get refreshed when resized may get an
    extra reload with this approach, but this seems not avoidable unless widget sets
    the viewport size right in advance (which from discussion with snorp and agi
    doesn't seem possible in the general case).
    
    What used to happen is that we were triggering a redundant resize reflow from
    the initial paint which didn't update the layout viewport (because the content
    viewer and co had the right viewport from the previous navigation).
    
    Now that we optimize those away, I think our behavior should be correct.
    
    Differential Revision: https://phabricator.services.mozilla.com/D46956
    
    --HG--
    extra : moz-landing-system : lando
    161cb16c