W3C

CSS Exclusions Module Level 1

編集者草案

この日本語訳は非公式な文書です…(翻訳更新:

このページは、W3Cにより編集者草案として公開された CSS Exlusion Module Level 1 を日本語に翻訳したものです。 (初公表日:

この文書についての詳細
このバージョン(原文 URL )
https://drafts.csswg.org/css-exclusions/
最新公表バージョン
https://www.w3.org/TR/css3-exclusions/
公表履歴
https://www.w3.org/standards/history/css3-exclusions/
フィードバック
CSSWG Issues Repository
編集
Rossen Atanassov (Microsoft)
Vincent Hardy (Adobe)
Alan Stearns (Adobe)
Suggest an Edit for this Spec
GitHub Editor
課題リスト
in Bugzilla
テスト一式
http://test.csswg.org/suites/css3-exclusions/nightly-unstable/
commit 履歴
https://github.com/w3c/csswg-drafts/commits/main/css-exclusions-1
索引など

要約

CSS Exclusions は、 周りに行内内容 [CSS2] をフローさせられるような,任意な区画を定義する。 CSS Exclusions は、 どの CSS ブロックレベルの要素上にも定義できる。 CSS Exclusions は、 以前までは,浮動体に制限されていた,内容の回り込みの観念を拡張する。 CSS Exclusions define arbitrary areas around which inline content ([CSS2]) can flow. CSS Exclusions can be defined on any CSS block-level elements. CSS Exclusions extend the notion of content wrapping previously limited to floats.

CSS とは…

この文書の位置付け

これは、 編集者草案の公な複製です… 【以下、この節の内容は,CSS 日本語訳 共通ページこの文書についての詳細に移譲。】

1. 序論

この節は規範的ではない。This section is non-normative.

この仕様は、 行内フロー内容が[ 要素の排他区画の外側に回り込める ]ようにする特能を,定義する。 This specification defines features that allow inline flow content to wrap around outside the exclusion area of elements.

1.1. 値定義

【 この節の内容は、 CSS 日本語訳 共通ページ に移譲。 】

2. 各種用語

排他ボックスexclusion box ), または 単に “排他体( exclusion )”
他のボックスに対する排他区画を定義するボックス。 排他ボックスは、 自身による排他区画を,自身の包含ブロック回り込み文脈に供与する。 要素が生成するボックスを排他ボックスにするためには、 wrap-flow プロパティを利用する — ただし、 float の算出値が none 以外になる要素は,排他体にはならない。 A box ([CSS3BOX]) that defines an exclusion area for other boxes. The wrap-flow property is used to make an element’s generated box an exclusion box. An exclusion box contributes its exclusion area to its containing block’s wrapping context. An element with a float computed value other than none does not become an exclusion.
【 語 “排他体” は、[ 排他ボックス, 排他ボックスを生成する要素 ]の総称 (同時に両方の意味を兼ねることもある)。 】
排他区画exclusion area

行内フロー内容を,排他ボックスの周りに排他するときに利用される区画。 排他区画は、 排他ボックスに対するボーダーボックスに等価である。 The area used for excluding inline flow content around an exclusion box. The exclusion area is equivalent to the border box for an exclusion box.

CSS Shapes も実装する UA においては、 ボーダーボックスに代わって, shape-outside プロパティが,排他区画を定義する。 If a user agent implements both CSS Exclusions and CSS Shapes, the shape-outside property defines the exclusion area instead of the border box.

排他要素exclusion element ), または 単に “排他体( exclusion )”
排他要素は、 排他ボックスを生成するような,浮動体でないブロックレベルの要素である。 要素は、 その wrap-flow プロパティの算出値が auto でないとき,排他ボックスを生成する。 An exclusion element is a block-level element which is not a float and generates an exclusion box. An element generates an exclusion box when its wrap-flow property’s computed value is not auto.
【 論理的には、 “排他ボックスを生成する要素” と定義しても同じ。 [ 浮動体( float が非 none )でもある排他ボックス, ブロックレベルでない排他ボックス ]は存在し得ないので( wrap-flow プロパティを見よ)。 】
回り込み文脈wrapping context
ボックスの回り込み文脈は、 それに結び付けられた排他ボックスたちから供与された排他区画たちが成すコレクションである。 レイアウトにおいては、 ボックスの行内フロー内容は,ボックスの回り込み区画 — すなわち,ボックスの内容区画から,それらの排他区画を除いた区域 — 内に包装される†。 The wrapping context of a box is a collection of exclusion areas contributed by its associated exclusion boxes. During layout, a box wraps its inline flow content in the wrapping area that corresponds to the subtraction of its wrapping context from its own content area.
【† より厳密には、 wrap-flow プロパティの値に依存して,より制約された区域内に収められる場合もある。 】
ボックスは、 自身の包含ブロック回り込み文脈を継承する — wrap-through プロパティを利用して,特にそれを設定し直していない限り。 A box inherits its containing block’s wrapping context unless it specifically resets it using the wrap-through property.
内容区画content area
ボックスの行内フロー内容のレイアウトには、 通常は,内容区画が利用される。 The content area is normally used for layout of the inline flow content of a box.
回り込み区画wrapping area
回り込み文脈に影響されるボックスにおいて,その行内フロー内容のレイアウトに利用される区画 — ボックスの内容区画から,回り込み文脈 【を成す排他区画たち】 を除いた区域として定義される。 The area used for layout of inline flow content of a box affected by a wrapping context, defined by subtracting the wrapping context from its content area.
要素の内側inside
要素の外側outside
この仕様においては、要素の[ 内側外側 ]は[ 要素の子孫たち/それら以外 ]が成す DOM 内容を指す。 In this specification, outside refers to DOM content that is not a descendant of an element while inside refers to the element’s descendants.

【 以下に挙げる記述は、 この訳による補完。 】

始端( start
終端( end
この仕様における[ 始端/終端 ]は、 他が指定されない限り,行内基底方向の[ 始端/終端 ]を指す。
行内( inline
この仕様における[ 行内内容/行内フロー内容 ]の “行内” は、 行内レベルを意味する(不可分な行内も含まれる)【と見受けられる】

3. 排他体(排他ボックス)

排他要素(排他体)は、[ 自身の包含ブロック回り込み文脈に供与する,排他区画 ]を定義する。 その帰結として、 排他体は,包含ブロックの子孫のレイアウトに影響する。 Exclusion elements define exclusion areas that contribute to their containing block’s wrapping context. As a consequence, exclusions impact the layout of their containing block’s descendants.

要素の行内内容は、 要素の内容区画 内にレイアウトされつつ,[ 要素に結び付けられた回り込み文脈に属する排他区画 ]を回り込む — 要素自身も排他体である場合の,それによる排他区画は除いて。 また,排他体どうしの互いの影響は、 § 排他体たちの順序 にて説明されるとおり, z-index プロパティにより制御される。 Elements lay out their inline content in their content area and wrap around the exclusion areas in their associated wrapping context. If the element is itself an exclusion, it does not wrap around its own exclusion area and the impact of other exclusions on other exclusions is controlled by the z-index property as explained in the 'exclusions order' section.

3.1. 排他体の宣言法

要素は、 その wrap-flow プロパティの算出値が auto 以外であるとき,排他体になる。 An element becomes an exclusion when its wrap-flow property has a computed value other than auto.

3.1.1. wrap-flow プロパティ

名前 wrap-flow
auto | both | start | end | minimum | maximum | clear
初期値 auto
適用対象 ブロックレベルの要素
継承 されない
百分率 受容しない
算出値 指定されたキーワード — ただし、 float の算出値が none でない要素に対しては auto as specified except for element’s whose float computed value is not none, in which case the computed value is auto.
正準的順序 文法に従う
アニメーション型 【指定されていない(離散的?)】

このプロパティに対する各種 値の意味は: The values of this property have the following meanings:

auto
排他体は作成されない。 行内フロー内容は、 通例どおり要素と相互作用する。 特に,要素が浮動体 [CSS2] である場合、 【他の値が指定されたとしても,】 ふるまいは変化しない。 No exclusion is created. Inline flow content interacts with the element as usual. In particular, if the element is a float (see [CSS2]), the behavior is unchanged.
both
行内フロー内容は、 排他体の[ 始端辺, 終端辺 ]いずれの周りにもフローできる。 Inline flow content can flow on all sides of the exclusion.
start
行内フロー内容は,排他区画の始端辺の周りにフローできる一方で、 終端辺の周りの区画は,空いたままになるものとする。 Inline flow content can flow around the start edge of the exclusion area but must leave the area next to the end edge of the exclusion empty.
end
行内フロー内容は,排他区画の終端辺の周りにフローできる一方で、 始端辺の周りの区画は,空いたままになるものとする。 Inline flow content can flow around the end edge of the exclusion area but must leave the area next to the start edge of the exclusion empty.
minimum
行内フロー内容は,排他区画の[ フロー内容の包含ブロックの中で、 始端, 終端のうち,可用な空間が狭い側の辺† ]の周りにフローできる一方で、 他方の辺の周りは,空いたままになるものとする。 Inline flow content can flow around the edge of the exclusion with the smallest available space within the flow content’s containing block, and must leave the other edge of the exclusion empty.
【 †両側の空間が等しくなる場合のふるまいは規定されていない(UA に依存することになる)。 次項も同様。 】
maximum
行内フロー内容は,排他区画の[ フロー内容の包含ブロックの中で、 始端, 終端のうち,可用な空間が広い側の辺 ]の周りにフローできる一方で、 他方の辺の周りは空いたままになるものとする。 Inline flow content can flow around the edge of the exclusion with the largest available space within the flow content’s containing block, and must leave the other edge of the exclusion empty.
clear
行内フロー内容は、 フロー内容のブロック進行方向において,排他体の 前/後 にしかフローできない。 排他体の[ 始端/終端 ]辺の周りの区画は,空いたままになるものとする。 Inline flow content can only flow before and after the exclusion in the flow content’s block direction and must leave the areas next to the start and end edges of the exclusion empty.

要素上のプロパティの算出値が auto になる場合、 要素は排他体にならない。 If the property’s computed value is auto, the element does not become an exclusion.

算出値が auto 以外になる場合、 要素は排他体になる。 その排他区画は,要素の包含ブロックの回り込み文脈に供与され、 包含ブロックの子孫たちは,排他区画を回り込むようになる。 Otherwise, a computed wrap-flow property value of both, start, end, minimum, maximum or clear on an element makes that element an exclusion element. It’s exclusion area is contributed to its containing block’s wrapping context, causing the containing block’s descendants to wrap around its exclusion area.

図 1. wrap-flow: start を伴う排他体と 各種 書字モードとの相互作用。 Exclusion with wrap-flow: start interacting with various writing modes.

排他体に関連する辺の決定法は、 “排他区画” を回り込んでいる内容の,書字モード [CSS3-WRITING-MODES] に依存する。 Determining the relevant edges of the exclusion depends on the writing mode [CSS3-WRITING-MODES] of the content wrapping around the 'exclusion area'.

排他要素は、 自身の内容に対し,新たなブロック整形文脈 [CSS2] を確立する。 An exclusion element establishes a new block formatting context (see [CSS2]) for its content.

図 2. 各種 排他体の組み合せ Combining exclusions

上の図は、 排他体たちが どう組み合されるかを示している。 最外縁のボックスは、 要素の内容ボックスを表現する。 暗い灰色のボックス[ A, B, C, D ]は、 要素の回り込み文脈に属する排他体たちを表現する。 これらに対する wrap-flow の算出値は、 順に[ both, start, end, clear ]になる。 明るい灰色の区画は、[ wrap-flow 値の結果として,行内レイアウトにおいて排他される ]ような,追加の区画を示す。 例えば, B の右の区画は、 右向き書字モード内容の行内レイアウトには,利用できない — Bwrap-flowstart なので。 The above figure illustrates how exclusions are combined. The outermost box represents an element’s content box. The A, B, C and D darker gray boxes represent exclusions in the element’s wrapping context. A, B, C and D have their respective wrap-flow computed to both, start, end and clear respectively. The lighter gray areas show the additional areas that are excluded for inline layout as a result of the wrap-flow value. For example, the area to the right of B cannot be used for inline layout of left-to-right writing mode content because the wrap-flow for B is start.

背景が薄青色の区画は、[ 右向き書字モードである要素の行内内容 ]のレイアウトに,どの区画が可用になるかを示す。 明るい/暗い 灰色で表現される,すべての区画は、 (右向き書字モードの)行内内容のレイアウトには可用でない。 The background blue area shows what areas are available for a left-to-right writing mode element’s inline content layout. All areas represented with a light or dark shade of gray are not available for (left-to-right writing mode) inline content layout.

wrap-flow プロパティ値が適用される,排他体である格子アイテムThe wrap-flow property values applied to exclusions as grid items.

<div id="格子">
    <div id="右上" class="排他"></div>
    <div id="左下" class="排他"></div>
    <div id="内容">Lorem ipsum…</div>
</div>

<style type="text/css">
#格子 {
    width: 30em;
    height: 30em;

    /* 各 升のサイズが均一な 4 × 4 の格子 */
    display: grid;
    grid: 1fr 1fr 1fr 1fr / 1fr 1fr 1fr 1fr;

#右上 {
    /* 左から 3 列目, 上から 2 段目, 1 × 1 の升を占める格子アイテム */
    grid-area: 3/2;
}

#左下 {
    /* 左から 2 列目, 上から 3 段目, 1 × 1 の升を占める格子アイテム */
    grid-area: 2/3;
}

.排他 {
    wrap-flow: <下を見よ>
}

#内容 {
    /* 格子全体を占める格子アイテム */
    grid-area: 1/1/span 4/span 4;
}
</style>

【 この例の原文 CSS は [CSS3-GRID-LAYOUT] の古い仕様に基づくと見られるので、 修正を加えている。 】

次の図に,wrap-flow プロパティに対する各種 値による視覚的な描画を示す。 灰色の格子線(罫)が,格子升を作り、 薄青色の区画は(格子により位置された)排他ボックスを表す: The following figures illustrate the visual rendering for different values of the wrap-flow property. The gray grid lines are marking the grid cells and the blue area is the exclusion box (positioned by the grid).

  • .排他{ wrap-flow: auto; }
  • .排他{ wrap-flow: both; }
  • .排他{ wrap-flow: start; }
  • .排他{ wrap-flow: end; }
  • .排他{ wrap-flow: minimum; }
  • .排他{ wrap-flow: maximum; }
  • .排他{ wrap-flow: clear; }

3.2. 排他体の視野と効果

排他体が影響するのは: [[ 排他体の包含ブロック ]から descend する【子ボックスである?】行内フロー内容, および 同じ包含ブロックのすべての子孫要素の行内フロー内容 ]である。 排他体の包含ブロックの内側にある,すべての行内フロー内容が影響される。 wrap-through プロパティを利用すれば、 要素の外側で定義される排他体による 【要素の内側の内容のレイアウトに対する】 効果を止めれる (§ 排他体の伝播を見よ)。 An exclusion affects the inline flow content descended from the exclusion’s containing block (defined in CSS 2.1 10.1) and that of all descendant elements of the same containing block. All inline flow content inside the containing block of the exclusions is affected. To stop the effect of exclusions defined outside an element, the wrap-through property can be used (see the propagation of exclusions section below).

positionfixed にされた排他体に対する包含ブロックは、 根要素により確立されることに留意。 As a reminder, for exclusions with position:fixed, the containing block is established by the root element.

3.3. 排他体の伝播

既定では、 要素は,自身の親の回り込み文脈を継承する。 言い換えれば、 それ【要素内容のレイアウト】は,要素の外側で定義される排他体の対象になる【要素の行内内容は,それらの排他体を回り込む】By default, an element inherits its parent wrapping context. In other words it is subject to the exclusions defined outside the element.

wrap-through プロパティを none に設定すると、 要素は自身の親の回り込み文脈を継承しなくなる。 言い換えれば、 要素の外側で定義された排他体によるレイアウトの効果は、 要素の子たちには及ばなくなる。 Setting the wrap-through property to none prevents an element from inheriting its parent wrapping context. In other words, exclusions defined outside the element, have not effect on the element’s children layout.

要素の子孫により定義される排他体は、 依然として,子孫の包含ブロックの回り込み文脈【子孫による排他区画を】供与する。 その包含ブロックが[[ 要素の子であって, wrap-through の算出値が none になるもの ]または要素自身 ]【が確立したもの】である場合、 排他体は,依然として[ その包含ブロック【を確立した】要素 ]の子たちに効果が及ぶ。 Exclusions defined by an element’s descendants still contribute to their containing block’s wrapping context. If that containing block is a child of an element with wrap-through computes to none, or the element itself, then exclusion still have an effect on the children of that containing block element.

3.3.1. wrap-through プロパティ

名前 wrap-through
wrap | none
初期値 wrap
適用対象 ブロックレベルの要素
継承 されない
百分率 受容しない
算出値 指定されたキーワード
正準的順序 文法に従う
アニメーション型 【指定されていない(離散的?)】

このプロパティに対する各種 値の意味は: The values of this property have the following meanings:

wrap
要素は、 自身の親ノードの回り込み文脈を継承する。 要素の子孫である行内内容は、 要素の外側†にて定義される排他体たちを回り込む。 【† “継承” なので、次項により継承が途切れる所までの “外側”。】 The element inherits its parent node’s wrapping context. Its descendant inline content wraps around exclusions defined outside the element.
none
要素は、 自身の親ノードの回り込み文脈を継承しない。 要素の子孫である行内内容が回り込むのは、 要素の内側にて定義される排他区画に限られる。 The element does not inherit its parent node’s wrapping context. Its descendants are only subject to exclusion areas defined inside the element.

wrap-through プロパティを利用して,排他体の効果を制御する例: Using the wrap-through property to control the effect of exclusions.

<style type="text/css">
#格子 {
    /* 4 × 4 の格子 */
    display: grid;
    grid: 9fr 8fr 8fr 9fr / 1fr 1fr 1fr 1fr;
}

#真中 {
    grid-area: 2/2/span 2/span 2;
    wrap-flow: both;
    background-color: rgba(220, 230, 242, 0.5);
}

#上半分 {
    grid-area: 1/1/span 4/span 2;
    wrap-through: wrap;
}

#下半分 {
    grid-area: 1/3/span 4/span 2;
    wrap-through: none;
}
</style>

<div id="格子">
    <div id="真中"></div>
    <div id="上半分">
         Lorem ipsum dolor sit amet...
    </div>
    <div id="下半分">
         Lorem ipsum dolor sit amet...
    </div>
</div>

【 この例の原文 CSS は [CSS3-GRID-LAYOUT] の古い仕様に基づくと見られるので、 修正を加えている。 】

3.4. 排他体たちの順序

排他体たちは、 塗り順序に従う( [CSS2] 付録 E を見よ)。 排他体は,文書における順序の逆順に適用される。 最後の排他体は,他のすべての排他体の手前に現れ【るように見え】、 したがって[ 先行する他のすべての排他体や,同じ包含ブロックの子孫である要素 ]の行内フロー内容に影響する。 有位置排他ボックスに対しては、 z-index プロパティを利用して順序付けを変更できる。 静的に位置された( position: static )排他体は、 z-index プロパティに影響されないので,塗り順序に従う。 Exclusions follow the painting order (See [CSS2] Appendix E). Exclusions are applied in reverse to the document order in which they are defined. The last exclusion appears on top of all other exclusion, thus it affects the inline flow content of all other preceding exclusions or elements descendant of the same containing block. The z-index property can be used to change the ordering of positioned exclusion boxes (see [CSS2]). Statically positioned exclusions are not affected by the z-index property and thus follow the painting order.

排他体たちの順序付け。 Ordering of exclusions.

<style type="text/css">
.exclusion  {
  wrap-flow: both;
  position: absolute;
  width: 200px;
}
.左上 {
  top: 10px;
  left: 10px;
  background-color: lightblue;
}
.真中 {
  top: 90px;
  left: 90px;
  background-color: lightgreen;
}
.右下 {
  top: 170px;
  left: 170px;
  background-color: pink;
}
</style>

<div class="exclusion 左上">
    The top left div...
</div>
<div class="exclusion 真中">
    The middle div...
</div>
<div class="exclusion 右下">
    The bottom right div...
</div>
  • .真中 { z-index: auto; }
  • .真中 { z-index: 1; }

CSS 排他体の処理モデルは不正? (Issue-15183Is the CSS exclusions processing model incorrect?

現在の草案は、 衝突回避モデルを伴わないような,排他体のモデルを供する。 CSS における既存の排他モデルは、 浮動体を利用している — それは[ 排他体, 衝突回避 ]の両ふるまいを備える。 衝突回避を伴わない排他体を許容することは有害になり得る懸念が提起されている — 特に、 絶対的に位置された要素に対し。 考えるべき選択肢には、 次の三種がある: The current draft provides a model for exclusions without a collision-avoidance model. The existing exclusion model in CSS uses floats, which have both exclusion and collision-avoidance behavior. Concerns have been raised that allowing exclusions without collision avoidance could be harmful, particularly with absolutely-positioned elements. Three options should be considered:

  1. 衝突回避を伴わない位置決めスキームでも、 排他体たちを許容する。 Allow exclusions in positioning schemes with no collision avoidance.
  2. 衝突回避を伴わない位置決めスキームでは、 排他体たちを許容しない。 Disallow exclusions in positioning schemes with no collision avoidance.
  3. 衝突回避のふるまいを伴わない位置決めスキームに対し,それを定義した上で,このふるまいを排他体に対し既定で利用する。 Define collision-avoidance behavior for positioning schemes without it, and use this behavior by default with exclusions.

3.5. 処理モデル

3.5.1. 説明

排他は、 2 段階の処理で適用される: Applying exclusions is a two-step process:

  • 段 1: 各 回り込み文脈に対し,どの排他ボックスが属するか 【どの排他区画が供与されるか】 を解決する。 Step 1: resolve exclusion boxes belonging to each wrapping context
  • 段 2: 各 回り込み文脈に対し,順々に†、 それを解決して,包含ブロックをレイアウトする — すなわち: Step 2: resolve each wrapping context and lay out each containing block in turn:

    • 段 2-A: 回り込み文脈に属する排他ボックスたちの位置とサイズを解決する。 Step 2-A: resolve the position and size of exclusion boxes
    • 段 2-B排他区画たちを回り込むように,包含ブロックの内容をレイアウトする。 Step 2-B: lay out containing block, wrapping around each exclusion area

    【† “各〜に対し,順々に( each 〜 in turn )”: 後述の例に見られるように、 これは実際には, 段 2-B が再帰的に[ 描画ツリーの各子に対し段 2 を呼び出す ]ことを意味する。 】

3.5.2. 段 1: 各 回り込み文脈に属する排他ボックスたちを解決する

この段では、 UA は,各 排他区画がどの包含ブロックに属するかを決定する。 これは、 包含ブロックの定義, および wrap-flow の算出値が auto でない要素に基づく,単純な段である。 In this step, the user agent determines which containing block each exclusion area belongs to. This is a simple step, based on the definition of containing blocks and elements with a computed value for wrap-flow that is not auto.

3.5.3. 段 2: 回り込み文脈を解決して各 包含ブロックをレイアウトする

この段では、 UA は、 描画ツリー [CSS2] の上層から順に,各 包含ブロックを 2 段に分けて処理する。 In this step, starting from the top of the rendering tree (see [CSS2]), the agent processes each containing block in two sub-steps.

3.5.4. 段 2-A: 各 排他ボックスの位置とサイズを解決する

回り込み文脈における排他ボックスの位置とサイズを解決するとき、 レイアウトが要求されることもあれば,そうでないこともある。 例えば,排他ボックスが絶対的に位置され, サイズされている場合には必要ないが、 他の状況では,包含ブロックの内容をレイアウトすることが要求される。 Resolving the position and size of exclusion boxes in the wrapping context may or may not require a layout. For example, if an exclusion box is absolutely positioned and sized, a layout may not be needed to resolve its position and size. In other situations, laying out the containing block’s content is required.

このレイアウトが要求されるときは、 どの排他区画も適用することなく,遂げられる。 言い換えれば、 包含ブロックは,回り込み文脈を伴わずにレイアウトされる。 When a layout is required, it is carried out without applying any exclusion area. In other words, the containing block is laid out without a wrapping context.

この段は、 与えられた回り込み文脈に属する すべての排他ボックスに対し,それぞれの位置とサイズを得る。 各 排他ボックスは,最上層から順々に処理され、 算出された各 排他区画が,包含ブロック回り込み文脈に供与される。 Step 2-A yields a position and size for all exclusion boxes in the wrapping context. Each exclusion box is processed in turn, starting from the top-most, and each exclusion area is computed and contributed to the containing block’s wrapping context.

この段においては、 position : fixed にされた 排他ボックスの位置とサイズを解決するときは,scrolling は無視される。 Scrolling is ignored in this step when resolving the position and size of position: fixed exclusion boxes.

包含ブロック回り込み文脈が算出されたなら、 その回り込み文脈に属する すべての排他ボックスは、 通常のフローから除去される。 Once the containing block’s wrapping context is computed, all exclusion boxes in that wrapping context are removed from the normal flow.

3.5.5. 段 2-B: 回り込みが適用される包含ブロックをレイアウトする

最後に、 包含ブロックの内容が,その行内内容を[ 回り込み文脈排他区画 ]を回り込むように、 レイアウトされる。 Finally, the content of the containing block is laid out, with the inline content wrapping around the wrapping context’s exclusion area.

包含ブロック自身が排他ボックスであるときは、 § 排他体たちの順序 による規則が,[ どの排他体が,ボックスの行内/子孫の内容に影響するか ]を定義する。 When the containing block itself is an exclusion box, then rules on exclusions order define which exclusions affect the inline and descendant content of the box.

3.5.6. 処理モデルの例

この節では、 排他体たちの処理モデルを,単純かつ[ レイアウトの依存関係と再レイアウトの課題に取り組むに十分な複雑さ ]を含むような例を用いて示す。 This section illustrates the exclusions processing model with an example. It is meant to be simple. Yet, it contains enough complexity to address the issues of layout dependencies and re-layout.

次の例におけるコード片には、 文書の行内内容に影響する 2 個の排他体がある: The code snippet in the following example has two exclusions affecting the document’s inline content.

<html>
<style>
#d1 {
    position:relative;
    height: auto;
    color: #46A4E9;
    border: 1px solid gray;
}

#e1 {
    wrap-flow: both;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40%;
    height: 40%;
    border: 1px solid red;
    margin-left: -20%;
    margin-top: -20%;
}

#d2 {
    position: static;
    width: 100%;
    height: auto;
    color: #808080;
}

#e2 {
    wrap-flow: both;
    position: absolute;
    right: 5ex;
    top: 1em;
    width: 12ex;
    height: 10em;
    border: 1px solid lime;
}
</style>
<body>
    <div id="d1">
        Lorem ipsusm ...
        <p id="e1"></p>
    </div>
    <div id="d2">
        Lorem ipsusm ...
        <p id="e2" ></p>
    </div>
</body>
</html>

以下の図に、 上の例による[ 文書の DOM ツリー ], および[ 生成されるブロックボックスたちからなるレイアウトツリー ]を順に示す: The following figures illustrate:the document’s DOM treethe layout tree of generated block boxes

DOM tree nodes
図 3. DOM ツリー DOM tree
Layout tree boxes
図 4. 生成されたブロックボックス群が成すレイアウトツリー Layout tree of generated block boxes
3.5.6.1. 段 1: 各 回り込み文脈に属する排他ボックスたちを解決する

図には、 各 要素に対応するボックスの レイアウトツリーにおける包含階層が, DOM ツリーから異なる様子が示されている。 例えば、[ e1 は 絶対的に位置されていて, d1 は 相対的に位置されている ]ので、 e1 から生成されるボックスは、 その包含ブロックである d1 ボックス内で位置される。 一方で、 e2 も絶対的に位置にされているが,その包含ブロックは初期包含ブロックである。 詳細は [CSS2] § 10.1 を見よ。 The figures illustrate how the boxes corresponding to the element sometimes have a different containment hierarchy in the layout tree than in the DOM tree. For example, the box generated by e1 is positioned in its containing block’s box, which is the d1-box, because e1 is absolutely positioned and d1 is relatively positioned. However, while e2 is also absolutely positioned, its containing block is the initial containing block (ICB). See the section 10.1 of the CSS 2.1 specification ([CSS2]) for details.

ツリーに対する包含ブロックを算出した結果として、 すべての要素について,その回り込み文脈に属しているボックスたちを決定できる: As a result of the computation of containing blocks for the tree, the boxes belonging to the wrapping contexts of all the elements can be determined:

  • html 要素に対する回り込み文脈は、 ボックス e2 を包含する: 以下, 回り込み文脈 1 と記す。 The wrapping context for the html element contains the e2 box: WC-1 (Wrapping Context 1)
  • body 要素に対する回り込み文脈は、 回り込み文脈 1 を継承する。 The wrapping context for the body element inherits the html element’s wrapping context: WC-1
  • d1 に対する回り込み文脈は、 body 要素の回り込み文脈回り込み文脈 1 を継承した上で,それに e1 ボックス を追加する。 したがって,その回り込み文脈は、[ e1 ボックス, e2 ボックス ]の 2 つからなる: 以下、 回り込み文脈 2 と記す。 The wrapping context for d1 inherits the body element’s wrapping context and adds the e1-box to it. So the wrapping context is made of both the e1-box and the e2-box: WC-2
  • d2 に対する回り込み文脈は、 回り込み文脈 1 を継承する。 The wrapping context for d2 inherits the body element’s wrapping context: WC-1
3.5.6.2. 段 2: 回り込み文脈を解決して 包含ブロックをレイアウトする

この段では、 各包含ブロックが順々に処理される。 各包含ブロックに対し, (概念的に) 2 つの段階を経る: In this step, each containing block is processed in turn. For each containing block, we (conceptually) go through two phases:

  1. 回り込み文脈を解決する: すなわち、 それに属する各 排他体【排他区画】の位置とサイズを解決する。 resolve the wrapping context: resolve the position and size of its exclusions
  2. 包含ブロックをレイアウトする。 lay out the containing block

上の例では、 次の各段に分けられる: In our example, this breaks down to:

  1. 【初期包含ブロックの回り込み文脈】 回り込み文脈 1 に属している排他体たちの 位置とサイズを解決する: その結果を以下、 解決済み回り込み文脈 1 と記す。 resolve the position and size of the exclusions belonging to WC-1: RWC-1 (Resolved Wrapping Context 1).
  2. 初期包含ブロック(の内容)をレイアウトする: lay out the initial containing block (i.e., lay out its content):

    1. html 要素の回り込み文脈を解決する: (継承により) 解決済み回り込み文脈 1 になる。 resolve the html element’s wrapping context: RWC-1
    2. html 要素をレイアウトする: lay out the html element:

      1. body 要素の回り込み文脈を解決する: (継承により) 解決済み回り込み文脈 1 になる。 resolve the body element’s wrapping context: RWC-1
      2. body 要素をレイアウトする: lay out the body element:

        1. d1 要素の回り込み文脈( = 回り込み文脈 2 )を解決する: resolve the d1 element’s wrapping context: RWC-2
        2. d1 要素をレイアウトする。 lay out the d1 element
        3. d2 要素の回り込み文脈を解決する: (継承により) 解決済み回り込み文脈 1 になる。 resolve the d2 element’s wrapping context: RWC-1
        4. d2 要素をレイアウトする。 lay out the d2 element
3.5.6.2.1. 回り込み文脈 1 の解決法

レイアウトツリーにおける最上層の回り込み文脈は,排他体 e2 を包含しており、 その位置とサイズは,解決される必要がある。 一般的に、 排他体の位置とサイズを算出するためには,他の内容をレイアウトすることが要求されることもあれば,されないこともある。 この例では、 排他体 e2 をレイアウトする必要はない — それは絶対的に位置されていて、 そのサイズもレイアウトせずに解決できるので。 この時点で、 回り込み文脈 1 は解決され,行内内容をレイアウトするときに利用できる。 The top-most wrapping context in the layout tree contains the e2 exclusion. Its position and size needs to be resolved. In general, computing an exclusion’s position and size may or may not require laying out other content. In this example, no content needs to be laid out to resolve the e2 exclusion’s position because it is absolutely positioned and its size can be resolved without layout either. At this point, RWC-1 is resolved and can be used when laying inline content out.

3.5.6.2.2. 回り込み文脈 2 の解決法

処理は類似する: 排他体 e1 の位置を解決する必要があり、 ここでも, e1 の包含ブロック( d1 )のレイアウトが要求され得る — この事例では、 実際に該当する: e1 の位置とサイズは、 d1 ボックスのサイズに相対的な百分率長さであり,その解決に依存するので。 そのため,まず d1 のレイアウトが,回り込み文脈を伴わずに(すなわち,排他を適用せずに)行われ、 それにより e1 のボックスの位置とサイズが得られる。 The process is similar: the position of the e1 exclusion needs to be resolved. Again, resolving the exclusion’s position and size may require processing the containing block (d1 here). It is the case here because the size and position of e1 depend on resolving the percentage lengths. The percentages are relative to the size of d1’s box. As a result, in order to resolve a size for d1’s box, a first layout of d1 is done without any wrapping context (i.e., no exclusions applied). The layout yields a position and size for e1’s box.

この時点で, e1, e2 のいずれも,その位置とサイズは解決されたので、 回り込み文脈 2 は解決されたことになる。 At this point, RWC-2 is resolved because the position and size of both e1 and e2 are resolved.

上の処理例における要点の一つは、 いったん要素の回り込み文脈(に属する排他体たちの位置とサイズ)が解決されたなら,それらの位置とサイズが,それ以上 処理されることはないことである — 要素のサイズが,[ ( 回り込み文脈 2 に対するときのように)回り込み文脈を考慮することなく行われるレイアウト ]と[ 解決された回り込み文脈の下で行われるレイアウト ]との間で変化するとしても。 これが、[ 回り込み文脈の解決 ]と[ 包含ブロックのレイアウト ]との間の循環依存を,断ち切るものである。 The important aspect of the above processing example is that once an element’s wrapping context is resolved (by resolving its exclusions' position and size), the position and size of the exclusions are not re-processed if the element’s size changes between the layout that may be done without considering any wrapping context (as for RWC-2) and the layout done with the resolved wrapping context. This is what breaks the possible circular dependency between the resolution of wrapping contexts and the layout of containing blocks.

3.6. 浮動体と排他体

3.6.1. 類似性

浮動体と排他体には、[ 行内内容が,このどちらも回り込む ]ことにおいて類似性がある。 しかしながら、 この 2 つには,ごく有意な相違点がある。 There are similarities between floats and exclusions in that inline content wraps around floats and also wraps around exclusion areas. However, there are very significant differences.

3.6.2. 相違点

視野: scope.\
浮動体は文書内でそれに後続する内容に適用される一方で、 排他体は,自身の包含ブロック内の内容に適用される。 While floats apply to content that follows in the document, exclusions apply to content in their containing block.
位置決め: positioning.\
浮動体は 行内フローの一部であり、 行ボックス上に float する。 作者は、 浮動体が 行ボックス上で どのように 右/左 へ移動するかを制御できる。 対照的に,排他体は、 格子レイアウト [CSS3-GRID-LAYOUT] flex レイアウト [CSS3-FLEXBOX] その他の どの位置決めスキームを利用して位置させることもできる。 Floats are part of the inline flow and float on the line box. Authors can control how the floats move on the line box, to the right or to the left. By contrast, exclusions can be positioned using any positioning scheme such as grid layout ([CSS3-GRID-LAYOUT]), flexible box ([CSS3-FLEXBOX]) or any other CSS positioning scheme.
関心の分離: separation of concerns.\
要素を浮動体にすることは、[ 要素の位置決めスキーム, 行内内容に対する効果 ]どちらも決定する。 要素を排他体にすることは、 行内内容に対する影響のみを決定し,位置決め手法に対しては拘束を課さない。 Making an element a float determines both its positioning scheme and its effect on inline content. Making an element an exclusion only determines its impact on inline content and does not impose constraints on its positioning method.

3.6.3. 相互運用能

3.6.3.1. 排他体に対する浮動体の効果

浮動体の効果は、 排他体の位置決めにも,排他体の行内内容のレイアウトにも及ぶ。 例えば,[ 排他体が行内ボックスであって,浮動体と同じ行上にある ]ならば、 当の排他体の位置は,他の行内内容と同様に — 段 2-A にて算出されるとおり — 浮動体から影響される。 Floats have an effect on the positioning of exclusions and the layout of their inline content. For example, if an exclusion is an inline-box which happens to be on the same line as a float, its position, as computed in Step 2-A will be impacted by the float, as is any other inline content.

3.6.3.2. 浮動体に対する排他体の効果

排他体の効果は、 行内内容に及ぶのと同様に,浮動体の位置決めにも及ぶ。 したがって、 段 2-B において, 浮動体は排他区画を避けることになる。 Exclusions have an effect on the positioning of floats as they have an effect on inline content. Therefore, in Step 2-B, floats will avoid exclusion areas.

プライバシーの考慮点

この仕様に対し報告された,新たなプライバシーの考慮点は、 無い。 No new privacy considerations have been reported on this specification.

セキュリティの考慮点

この仕様に対し報告された,新たなプライバシーの考慮点は、 無い。 No new security considerations have been reported on this specification.

謝辞

この仕様に貢献された、 次の方々に:

This specification is made possible by input from Andrei Bucur, Alexandru Chiculita, Arron Eicholz, Daniel Glazman, Arno Gourdol, Chris Jones, Bem Jones-Bey, Marcus Mielke, Alex Mogilevsky, Hans Muller, Mihnea Ovidenie, Virgil Palanciuc, Florian Rivoal, Peter Sorotokin, Bear Travis, Eugene Veselov, Stephen Zilles and the CSS Working Group members.

変更点

2015年 1月 15日 作業草案 からの変更点 Changes from the 15 January 2015 Working Draft
2013年 5月 28日 作業草案 からの変更点 Changes from the 28 May 2013 Working Draft
編集上の修正。 Editorial fixes.
2012年 5月 3日 作業草案 からの変更点 Changes from the 3 May 2012 Working Draft
CSS Shapes からこの仕様を分割した。 Split Exclusions from Shapes.
排他体の順序の例を改善した。 Improved exclusion order example.
編集上の/マークアップの修正。 Editorial and markup fixes.
CSS Shapes の § 変更点 も見よ。 See also the Changes section of CSS Shapes.

適合性

【この節の内容は CSS Snapshot ページに移譲。】

参照文献

文献(規範)

[CSS-ANCHOR-POSITION-1]
Tab Atkins Jr.; Elika Etemad; Ian Kilpatrick. CSS Anchor Positioning.
https://drafts.csswg.org/css-anchor-position-1/
日本語訳
[CSS-BOX-4]
Elika Etemad. CSS Box Model Module Level 4.
https://drafts.csswg.org/css-box-4/
日本語訳
[CSS-PAGE-FLOATS-3]
Johannes Wilm. CSS Page Floats.
https://drafts.csswg.org/css-page-floats/
[CSS-POSITION-3]
Elika Etemad; Tab Atkins Jr.. CSS Positioned Layout Module Level 3.
https://drafts.csswg.org/css-position-3/
日本語訳
[CSS-VALUES-3]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3.
https://drafts.csswg.org/css-values-3/
日本語訳Level 4 日本語訳
[CSS-VALUES-4]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 4.
https://drafts.csswg.org/css-values-4/
日本語訳
[CSS2]
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.
https://drafts.csswg.org/css2/
日本語訳日本語訳22.0 日本語訳3
[CSS22]
Bert Bos. Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification.
https://drafts.csswg.org/css2/
【↑】
[CSS3-WRITING-MODES]
Elika Etemad; Koji Ishii. CSS Writing Modes Level 3.
https://drafts.csswg.org/css-writing-modes-3/
日本語訳日本語訳
[CSS3BOX]
Elika Etemad. CSS Box Model Module Level 3.
https://drafts.csswg.org/css-box-3/
Level 4 日本語訳
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice.
https://datatracker.ietf.org/doc/html/rfc2119
日本語訳

文献(参考)

[CSS3-FLEXBOX]
Tab Atkins Jr.; et al. CSS Flexible Box Layout Module Level 1.
https://drafts.csswg.org/css-flexbox-1/
日本語訳
[CSS3-GRID-LAYOUT]
Tab Atkins Jr.; et al. CSS Grid Layout Module Level 1.
https://drafts.csswg.org/css-grid/
Level 2 日本語訳