Revision 7ab96ca42be6ce12b7bf98088d5d154f8f15be59 authored by Morten Stenshorne on 05 April 2018, 06:52:57 UTC, committed by Chromium WPT Sync on 05 April 2018, 06:52:57 UTC
When changing a layout object from in-flow to out-of-flow positioned, we
used to just remove it from the flow thread, risking that there'd no
longer be a column set to associate it with. However, an out-of-flow
positioned descendant may be contained by something that's inside the
flow thread, e.g. if the containing block of an absolutely positioned
object is a relatively positioned object, and that relatively positioned
object is contained by the flow thread.

Since it's hard to detect what the new containing block of an object is
going to be before it has actually gone out of flow, we'll still remove
it from the flow thread, but we'll now detect that we need to re-insert
it when computed style has updated.

Bug: 827424
Change-Id: I413348b0d3ecd0c4b5051e6e9d2a4526863bef60
Reviewed-on: https://chromium-review.googlesource.com/995439
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548354}
1 parent 54f844c
Raw File
callback-suspended.html
<!doctype html>
<meta charset=utf-8>
<title>Dispatching idle callbacks should be able to be suspended and then resumed</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>
<script>
  function withEventListener(target, event, handler) {
    handler = handler || (e => e);
    return new Promise(resolve => {
      let wrapper = function(e) {
        let result = handler(e);
        if (!result) {
          return;
        }

        resolve(result);
      }
      target.addEventListener(event, wrapper, { once: true });
    });
  }

  function makePostBackUrl(name) {
    return new URL('resources/post_name_on_load.html?name=' + name,
                   window.location).href;
  }

  function waitForMessage(message, handler) {
    return withEventListener(window, 'message', e => (e.data === message) && handler(e));;
  }

  function withWindow(name) {
    let win = window.open(makePostBackUrl(name))
    return waitForMessage(name, _ => win);
  }

  function navigateWindow(win, name) {
    win.location = makePostBackUrl(name);
    return waitForMessage(name, _ => win);
  }

  function waitDuration(delay) {
    return new Promise(resolve => {
      step_timeout(resolve, delay);
    })
  }

  function goBack(win) {
    var p = withEventListener(win, 'pagehide');
    win.history.back();
    return p;
  }

  promise_test(t => {
    let idleCalled = false;
    let running = true;
    return withWindow('foo')
      .then(win => {
        let callback = function(d) {
          idleCalled = true;
          if (running) {
            win.requestIdleCallback(callback);
          }
        };

        win.requestIdleCallback(callback);

        return navigateWindow(win, 'bar')
          .then(_ => idleCalled = false)
          .then(_ => waitDuration(2000))
          .then(_ => {
            assert_false(idleCalled, "idle callback shouldn't have been called yet");
            return goBack(win);
          })
          .then(_ => Promise.race([
            // At this point it's a matter of having bfcache ...
            waitDuration(2000)
              .then(_ => {
                assert_true(idleCalled, "idle callback should've been called by now");
                running = false;
              }),
            // ... or not. If not, we expect a load event.
            waitForMessage("foo", _ => win)
          ]))
          .then(_ => win.close())
          .catch(e => {
            win.close();
            throw e;
          })
      });
  });

</script>
back to top