layout/reftests/css-grid/grid-item-auto-min-size-clamp-001-ref.html
author James Teh <jteh@mozilla.com>
Wed, 01 Feb 2023 05:02:01 +0000
changeset 651150 dd0fdd1daa69783be36acd5c50544f3694eaa8f9
parent 405674 f9419024217dbfe3f337e965df3b039b1795ee7a
permissions -rw-r--r--
Bug 1813980: Check IsDoc before Parent in RemoteAccessibleBase::ApplyCrossDocOffset. r=morgan We call this function on every ancestor when calculating bounds. RemoteParent() currently requires a hash lookup, so it's more efficient to early return for !IsDoc() first. This is a micro-optimisation, but it might have some impact given that we call this on every ancestor, especially when hit testing, where we call Bounds() a lot. As a bit of drive-by cleanup, use RemoteParent() rather than calling Parent() and IsRemote/AsRemote(). Differential Revision: https://phabricator.services.mozilla.com/D168346

<!DOCTYPE html>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
  <meta charset="utf-8">
  <title>Reference: Clamp 'automatic minimum size' to definite max-sizing</title>
  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1300369">
  <style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }

.grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(auto, 15px));
  grid-template-rows:    repeat(2,minmax(auto, 10px));
  grid-gap: 1px;
  align-items: start;
  justify-items: start;
  float: left;
  border: 1px dashed;
  margin-right: 16px;
  margin-bottom: 14px;
}
.sz {
  width: 40px;
  height: 40px;
}

.definite {
  grid-template-columns: repeat(2,15px);
  grid-template-rows:    repeat(2,10px);
}
.min {
  grid-template-columns: repeat(2,minmax(max-content, 15px));
  grid-template-rows:    repeat(2,minmax(max-content, 10px));
}
.max {
  grid-template-columns: repeat(2,minmax(min-content, 15px));
  grid-template-rows:    repeat(2,minmax(min-content, 10px));
}

.larger .grid {
  grid-template-columns: repeat(2,minmax(auto, 25px));
  grid-template-rows:    repeat(2,minmax(auto, 28px));
}
.larger .definite {
  grid-template-columns: repeat(2,25px);
  grid-template-rows:    repeat(2,28px);
}
.larger .min {
  grid-template-columns: repeat(2,minmax(min-content, 25px));
  grid-template-rows:    repeat(2,minmax(min-content, 28px));
}
.larger .max {
  grid-template-columns: repeat(2,minmax(max-content, 25px));
  grid-template-rows:    repeat(2,minmax(max-content, 28px));
}

.stretch .grid {
  align-items: stretch;
  justify-items: stretch;
}

.a.grid {
  width: 34px;
}
.a.grid.max {
  width: 54px;
}
.larger .a.grid {
  width: 51px;
}
.larger .a.grid.max {
  width: 64px;
}
.a2.grid {
  width: 31px;
}
.larger .a2.grid {
  width: 51px;
}
.grid.sz.max {
  width: 40px;
}
.larger .grid.max.a span {
  width:20px;
}
.larger .grid.max.a2 span {
  width:20px;
}

span {
  grid-area: 1 / 1;
  font-size: 48px;
  background: grey;
  background-clip: content-box;
  border: 1px solid;
  padding: 1px 3px 5px 7px;
  margin: 3px 5px 7px 1px;
}
.span2 {
  grid-area: 1 / 1 / span 2 / span 2;
}
.grid.max span {
  width:20px;
}
.larger .grid .span2 {
  font-size: 32px;
  width: 20px;
  height: 32px;
}
.stretch.larger .grid .span2 {
  width: 33px;
  height: 39px;
}
.stretch.larger .grid.sz .span2 {
  width: 22px;
  height: 32px;
}
.stretch.larger .grid.definite .span2 {
  width: 33px;
  height: 39px;
}

x {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  background: cyan;
}
c {
  display: block;
  width: 20px;
  height: 32px;
}

br {
  clear: both;
}
  </style>
</head>
<body>

<div id="tests">
<div class="grid a"><x></x><span><c>X</c></span></div>
<div class="grid definite"><x></x><span><c>X</c></span></div>
<div class="grid a2"><x></x><span class="span2"><c>X</c></span></div>
<div class="grid definite"><x></x><span class="span2"><c>X</c></span></div>

<div class="grid sz"><x></x><span><c>X</c></span></div>
<div class="grid sz definite"><x></x><span><c>X</c></span></div>
<div class="grid sz"><x></x><span class="span2"><c>X</c></span></div>
<div class="grid sz definite"><x></x><span class="span2"><c>X</c></span></div>

<br>

<div class="grid min"><x></x><span><c>X</c></span></div>
<div class="grid min"><x></x><span class="span2"><c>X</c></span></div>
<div class="grid sz min"><x></x><span><c>X</c></span></div>
<div class="grid sz min"><x></x><span class="span2"><c>X</c></span></div>

<div class="grid a max"><x></x><span><c>X</c></span></div>
<div class="grid max"><x></x><span class="span2"><c>X</c></span></div>
<div class="grid a2 sz max"><x></x><span><c>X</c></span></div>
<div class="grid sz max"><x></x><span class="span2"><c>X</c></span></div>

<br>

</div>

<script>
var tests = document.getElementById('tests');

var n = tests.cloneNode(true);
var wrap = document.createElement('div');
wrap.className = 'larger';
wrap.appendChild(n);
document.body.appendChild(wrap);

var n = tests.cloneNode(true);
var wrap = document.createElement('div');
wrap.className = 'stretch';
wrap.appendChild(n);
document.body.appendChild(wrap);

var n = tests.cloneNode(true);
var wrap = document.createElement('div');
wrap.className = 'stretch larger';
wrap.appendChild(n);
document.body.appendChild(wrap);

</script>

</body></html>