Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 51 additions & 41 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -11470,6 +11470,14 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {
<p>Each <code>Document</code> has an <dfn>open dialogs list</dfn>, which is a <span>list</span> of
<code>dialog</code> elements, initially empty.</p>

<p>Each <code>Document</code> has a boolean <dfn
data-x="document-embedder-has-margin-attributes">embedder has margin attributes</dfn>, initially
false.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does caching it here mean we want it to be able to be different across navigations? Including possibly being different between a bfcache back and an ordinary back?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would match what happens with various other things that are snapshotted, e.g., sandbox and referrerpolicy. It seems reasonable to me to do the same here.


<p class="note">This is set to true when the container is a <code>frame</code> element or an
<code>iframe</code> element with a marginwidth or a marginheight attribute specified. This is used
in <a href="#body-margin-attributes">the Rendering section</a>.</p>

<h4>The <code>DocumentOrShadowRoot</code> interface</h4>

<p><cite>DOM</cite> defines the <code data-x="DOM
Expand Down Expand Up @@ -104449,6 +104457,12 @@ interface <dfn interface>NotRestoredReasons</dfn> {
<span data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
capability</span>.</p></li>

<li><p>Let <var>embedderHasMarginAttributes</var> be true if <var>embedder</var> is a
<code>frame</code> element or an <code>iframe</code> element that has a <code
data-x="attr-iframe-marginwidth">marginwidth</code> or a <code
data-x="attr-iframe-marginheight">marginheight</code> attribute specified, and false
otherwise.</p></li>

<li>
<p>Let <var>document</var> be a new <code>Document</code>, with:</p>

Expand Down Expand Up @@ -104489,6 +104503,9 @@ interface <dfn interface>NotRestoredReasons</dfn> {

<dt><span data-x="document-custom-element-registry">custom element registry</span></dt>
<dd>a new <code>CustomElementRegistry</code> object</dd>

<dt><span data-x="document-embedder-has-margin-attributes">embedder has margin attributes</span></dt>
<dd><var>embedderHasMarginAttributes</var></dd>
</dl>
</li>

Expand Down Expand Up @@ -111257,6 +111274,16 @@ location.href = '#foo';</code></pre>
data-x="concept-response-timing-info">timing info</span>'s <span
data-x="fetch-timing-info-start-time">start time</span>.</p></li>

<li><p>Let <var>embedder</var> be <var>navigationParams</var>'s <span
data-x="navigation-params-navigable">navigable</span>'s <span
data-x="nav-container">container</span>.</p></li>

<li><p>Let <var>embedderHasMarginAttributes</var> be true if <var>embedder</var> is a
<code>frame</code> element or an <code>iframe</code> element that has a <code
data-x="attr-iframe-marginwidth">marginwidth</code> or a <code
data-x="attr-iframe-marginheight">marginheight</code> attribute specified, and false
otherwise.</p></li>

<li>
<p>Let <var>document</var> be a new <code>Document</code>, with</p>

Expand Down Expand Up @@ -111314,6 +111341,9 @@ location.href = '#foo';</code></pre>

<dt><span data-x="document-custom-element-registry">custom element registry</span></dt>
<dd>a new <code>CustomElementRegistry</code> object</dd>

<dt><span data-x="document-embedder-has-margin-attributes">embedder has margin attributes</span></dt>
<dd><var>embedderHasMarginAttributes</var></dd>
</dl>
</li>

Expand Down Expand Up @@ -145088,11 +145118,12 @@ html, body { display: block; }</code></pre>
<!-- body { margin: 8px; } -->

<div algorithm>
<p>For each property in the table below, given a <code>body</code> element, the first attribute
that exists <span>maps to the pixel length property</span> on the <code>body</code> element. If
none of the attributes for a property are found, or if the value of the attribute that was found
cannot be parsed successfully, then a default value of 8px is <span>expected</span> to be used
for that property instead.</p>
<p id="body-margin-attributes">For each property in the table below, given a <code>body</code>
element <var>body</var>, the first attribute that exists <span>maps to the pixel length
property</span> on <var>body</var>. If none of the attributes for a property are found, or if the
value of the attribute that was found cannot be parsed successfully, then the <span>default body
margin</span> given <var>body</var> is <span>expected</span> to be used for that property
instead.</p>

<table>
<thead>
Expand All @@ -145101,52 +145132,31 @@ html, body { display: block; }</code></pre>
<th>Source
<tbody>
<tr>
<td rowspan="3"><span>'margin-top'</span>
<td>The <code>body</code> element's <code data-x="attr-body-marginheight">marginheight</code> attribute
<tr>
<td>The <code>body</code> element's <code data-x="attr-body-topmargin">topmargin</code> attribute
<tr>
<td>The <code>body</code> element's <span>container frame element</span>'s <code data-x="attr-iframe-marginheight">marginheight</code> attribute
<tbody>
<tr>
<td rowspan="3"><span>'margin-right'</span>
<td>The <code>body</code> element's <code data-x="attr-body-marginwidth">marginwidth</code> attribute
<tr>
<td>The <code>body</code> element's <code data-x="attr-body-rightmargin">rightmargin</code> attribute
<td rowspan="2"><span>'margin-top'</span>, <span>'margin-bottom'</span>
<td><var>body</var>'s <code data-x="attr-body-marginheight">marginheight</code> attribute
<tr>
<td>The <code>body</code> element's <span>container frame element</span>'s <code data-x="attr-iframe-marginwidth">marginwidth</code> attribute
<td><var>body</var>'s <code data-x="attr-body-topmargin">topmargin</code> attribute
<tbody>
<tr>
<td rowspan="3"><span>'margin-bottom'</span>
<td>The <code>body</code> element's <code data-x="attr-body-marginheight">marginheight</code> attribute
<tr>
<td>The <code>body</code> element's <code data-x="attr-body-bottommargin">bottommargin</code> attribute
<tr>
<td>The <code>body</code> element's <span>container frame element</span>'s <code data-x="attr-iframe-marginheight">marginheight</code> attribute
<tbody>
<tr>
<td rowspan="3"><span>'margin-left'</span>
<td>The <code>body</code> element's <code data-x="attr-body-marginwidth">marginwidth</code> attribute
<tr>
<td>The <code>body</code> element's <code data-x="attr-body-leftmargin">leftmargin</code> attribute
<td rowspan="2"><span>'margin-left'</span>, <span>'margin-right'</span>
<td><var>body</var>'s <code data-x="attr-body-marginwidth">marginwidth</code> attribute
<tr>
<td>The <code>body</code> element's <span>container frame element</span>'s <code data-x="attr-iframe-marginwidth">marginwidth</code> attribute
<td><var>body</var>'s <code data-x="attr-body-leftmargin">leftmargin</code> attribute
</table>
</div>

<div algorithm>
<p>If the <code>body</code> element's <span>node document</span>'s <span>node navigable</span> is
a <span>child navigable</span>, and the <span data-x="nav-container">container</span> of that
<span>navigable</span> is a <code>frame</code> or <code>iframe</code> element, then the
<dfn>container frame element</dfn> of the <code>body</code> element is that <code>frame</code> or
<code>iframe</code> element. Otherwise, there is no <span>container frame element</span>.</p>
<p>The <dfn>default body margin</dfn> given a <code>body</code> element <var>body</var> is 0px
if <var>body</var>'s <span>node document</span>'s <span
data-x="document-embedder-has-margin-attributes">embedder has margin attributes</span> is true,
and 8px otherwise.</p>
</div>

<p class="warning">The above requirements imply that a page can change the margins of another page
(including one from another <span>origin</span>) using, for example, an <code>iframe</code>. This
is potentially a security risk, as it might in some cases allow an attack to contrive a situation
in which a page is rendered not as the author intended, possibly for the purposes of phishing or
otherwise misleading the user.</p>
<p class="warning">The above requirements imply that a page can change the margins of another
page to 0px (including one from another <span>origin</span>) using, for example, an
<code>iframe</code>. This is potentially a security risk, as it might in some cases allow an
attack to contrive a situation in which a page is rendered not as the author intended, possibly
for the purposes of phishing or otherwise misleading the user.</p>

<hr>

Expand Down