pub struct LayoutBox<'a> {
pub dimensions: Dimensions,
pub box_type: BoxType<'a>,
pub children: Vec<LayoutBox<'a>>,
pub trim_leading_space: bool,
pub subtree_boxes: u32,
}Fields§
§dimensions: Dimensions§box_type: BoxType<'a>§children: Vec<LayoutBox<'a>>§trim_leading_space: bool文字ノードの先頭の空白(畳まれた 1 つ)を計測にも描画にも含めない印。 行頭に来た文字(CSS Text 3 §4.1.2)と、flex/grid 直下の匿名アイテムの文字に立つ。 【2026-10-14】従来は箱の幅だけ空白ぶん縮め、描画は空白込みで箱の左端から 描いていたため、行頭の文字が空白 1 つぶん右へずれた(index.htm のロゴ「IoT」)。
subtree_boxes: u32このボックスを根とする部分木内の LayoutBox 総数(build_layout_tree でボトムアップ事前計算)。
Implementations§
Source§impl<'a> LayoutBox<'a>
impl<'a> LayoutBox<'a>
pub(crate) fn font_size(&self) -> f32
Sourcepub fn client_width(&self) -> i32
pub fn client_width(&self) -> i32
W3C CSSOM View: 要素の padding box の幅 (px)。
Sourcepub fn client_height(&self) -> i32
pub fn client_height(&self) -> i32
W3C CSSOM View: 要素の padding box の高さ (px)。
Sourcepub fn scroll_dimensions(&self) -> (i32, i32, i32, i32)
pub fn scroll_dimensions(&self) -> (i32, i32, i32, i32)
W3C CSSOM View: 要素のパディングボックス基準での全コンテンツの最大右端・下端から、 スクロール可能領域の幅・高さを算出 (clientWidth / clientHeight 以上の値)。 戻り値: (client_width, client_height, scroll_width, scroll_height)
Sourcepub fn scroll_width(&self) -> i32
pub fn scroll_width(&self) -> i32
W3C CSSOM View: スクロール領域の幅 (px)。
Sourcepub fn scroll_height(&self) -> i32
pub fn scroll_height(&self) -> i32
W3C CSSOM View: スクロール領域の高さ (px)。
Source§impl<'a> LayoutBox<'a>
impl<'a> LayoutBox<'a>
Sourcefn explicit_content_height_px(&self, height_val: Option<&str>) -> Option<i32>
fn explicit_content_height_px(&self, height_val: Option<&str>) -> Option<i32>
明示の px 高さを content 高に換算して返す(box-sizing:border-box なら
縦の padding/border を引く)。明示 px でなければ None。
【2026-09-26】flex コンテナが border-box の明示高さをそのまま content 高に使い、
padding 分だけ背が高くなっていた(*{box-sizing:border-box} のサイト全般)。
Sourcefn h_non_content(&self) -> i32
fn h_non_content(&self) -> i32
横方向の content 以外(margin + border + padding の左右合計)。
Sourcepub(crate) fn inline_block_edges(&self) -> (i32, i32, i32, i32)
pub(crate) fn inline_block_edges(&self) -> (i32, i32, i32, i32)
行内で content の外側に占める (左, 右, 上, 下) の幅(margin+border+padding)。 inline-block(inline-flex 含む)のみ。素の inline 要素は box model 自体が 未適用(常に 0)なので従来どおり 0。レイアウト後に呼ぶこと。
【2026-10-09/2026-10-13】置換要素(img 等)は縦・横の margin+border+padding も
行内で占める(CSS 2.1 §10.3.2 / §10.6.2)。
Sourcepub(crate) fn styled_node(&self) -> Option<&'a StyledNode<'a>>
pub(crate) fn styled_node(&self) -> Option<&'a StyledNode<'a>>
このボックスに対応する StyledNode(テキスト/インライン/ブロック/コンテナ問わず)を返す。
Sourcepub(crate) fn is_replaced_inline(&self) -> bool
pub(crate) fn is_replaced_inline(&self) -> bool
置換要素(img/video/canvas/iframe 等、inline および flex/grid で blockify された inline-block)か。
Sourcepub(crate) fn box_baseline(&self) -> i32
pub(crate) fn box_baseline(&self) -> i32
行内の箱のベースライン(margin-box 上端からの距離)。 CSS 2.1 §10.8.1:
- 置換要素(img, input 等): 下マージン端
- inline-block: overflow が visible 以外、または行ボックスを持たない場合は下マージン端。 それ以外は最後の行ボックス(最後のテキスト/インライン子孫)のベースライン。
- 素の inline(InlineNode): フォントの ascent(+ 行送りの中央揃え leading)。
Sourcefn last_inflow_baseline(&self) -> Option<i32>
fn last_inflow_baseline(&self) -> Option<i32>
インラインブロック内の最後のインライン要素のベースラインを、 自身の content-box 上端からの相対距離として取得する。
Sourcefn has_inflow_text(&self) -> bool
fn has_inflow_text(&self) -> bool
子孫に空白以外の文字ノードがあるか(inline-block が行ボックスを持つかの近似)。
Sourcefn is_collapsible_space(&self) -> bool
fn is_collapsible_space(&self) -> bool
空白だけの文字ノードで、空白が畳まれる(white-space が normal/nowrap/pre-line)もの。
Sourcefn collapsed_space_width(&self) -> i32
fn collapsed_space_width(&self) -> i32
畳まれた空白 1 つの幅(描画と同じ書体・letter/word-spacing 込み)。
Sourcefn is_blank_inline(&self) -> bool
fn is_blank_inline(&self) -> bool
中身が空白だけの素の inline 要素か(<span> </span>。前後の空白と畳まれる)。
Sourcepub(crate) fn is_whitespace_text(&self) -> bool
pub(crate) fn is_whitespace_text(&self) -> bool
空白だけの文字ノードか(行内に並んでも見えず、揃えの対象にしない)。
Sourcefn text_ends_with_space(&self) -> bool
fn text_ends_with_space(&self) -> bool
テキストノードで末尾に空白を持つか(改行・タブ含む)。
Sourcefn text_starts_with_space(&self) -> bool
fn text_starts_with_space(&self) -> bool
テキストノードで先頭に空白を持つか(改行・タブ含む)。
Sourcefn inline_child_space_adjust(
&self,
measured: i32,
after_space: Option<bool>,
) -> (i32, bool, bool)
fn inline_child_space_adjust( &self, measured: i32, after_space: Option<bool>, ) -> (i32, bool, bool)
インライン要素の中(layout_inline)で並べる子の幅を、畳まれた空白の分だけ直す(2026-11-18)。
【なぜ必要か】ブロックの直下の行(layout_block の行内の子)は要素間の空白・文字の末尾の空白に
半角 1 つぶんの幅を持たせている(2026-10-09)が、インライン要素の中の子は持たせておらず、
<span><b>w0</b> <i>x</i></span>・<span>w0 <i>x</i></span> の空白が消えて「w0x」と詰まっていた。
measured は子の計測幅(文字は末尾の空白を含まず、先頭の空白は trim_leading_space が偽なら含む)。
after_space は直前が空白だったか(None はインライン要素の最初の行の先頭で、前の状態が分からない。
従来どおり空白だけの子は幅 0、先頭の空白は残す)。返すのは(幅、先頭の空白を落とすか、この子の後ろは空白か)。
Sourcefn align_line_baselines(
children: &mut [LayoutBox<'_>],
start: usize,
end: usize,
) -> i32
fn align_line_baselines( children: &mut [LayoutBox<'_>], start: usize, end: usize, ) -> i32
[start, end) の子を 1 行とみなし、vertical-align(既定 baseline)に従って
各箱を垂直方向に整列させる(CSS 2.1 §10.8)。
整列後の行全体の高さを返す。
Sourcepub(crate) fn is_inline_flex(&self) -> bool
pub(crate) fn is_inline_flex(&self) -> bool
display: inline-flex の箱か(外側 InlineBlockNode・内側 flex)。
Sourcepub(crate) fn is_inline_grid(&self) -> bool
pub(crate) fn is_inline_grid(&self) -> bool
display: inline-grid の箱か(外側 InlineBlockNode・内側 grid)。
Sourcefn inline_flex_content_width(&self, avail: i32) -> i32
fn inline_flex_content_width(&self, avail: i32) -> i32
inline-flex の content 幅: 明示幅があればそれ、無ければ shrink-to-fit (flex 行の max-content を利用幅で頭打ち。下限は min-content)。
Sourcefn layout_as_flex_at(&mut self, x: i32, y: i32, content_w: i32)
fn layout_as_flex_at(&mut self, x: i32, y: i32, content_w: i32)
自身を flex コンテナとして content 幅 content_w・content 原点 (x, y) に組む。
layout_flex は FlexNode しか受け付けないので、その間だけ型を差し替える。
Sourcefn layout_inline_flex(&mut self, containing_block: Dimensions)
fn layout_inline_flex(&mut self, containing_block: Dimensions)
display: inline-flex のレイアウト。位置の決め方は layout_inline と同じ
(cb の content 原点 + 縦カーソル + margin/border/padding)で、親が最後に
スロット位置へ子孫ごと平行移動する。
Sourcefn translate_y(&mut self, dy: i32)
fn translate_y(&mut self, dy: i32)
自身と全子孫の絶対 y 座標を dy だけ平行移動する(table セルの vertical-align 実装用)。
各ボックスの content.y は既に絶対ピクセル座標として確定しているため、
この再帰1回で子孫すべての位置がまとめてずれる。
Sourcepub(crate) fn translate(&mut self, dx: i32, dy: i32)
pub(crate) fn translate(&mut self, dx: i32, dy: i32)
自身と全子孫の絶対座標を (dx, dy) だけ平行移動する。
多段組で「通常フローで積み終えた子を列の位置へ移す」ために使う。
translate_y の 2 軸版で、考え方は同じ(content 座標が絶対値なので
再帰 1 回で子孫がまとめてずれる)。
Sourcefn translate_collapse_margin_top(
&mut self,
dy: i32,
parent_establishes_cb: bool,
)
fn translate_collapse_margin_top( &mut self, dy: i32, parent_establishes_cb: bool, )
親ブロックと先頭子の上マージン相殺時に、子を -cmt 上へ引き上げる。
子自身が絶対配置の包含ブロックを持たない場合、子孫の position: absolute は
外側の包含ブロック基準で既に確定しているため移動から除外する。
Sourcefn layout_captions_at(
&mut self,
indices: &[usize],
base_x: i32,
y: i32,
width: i32,
) -> i32
fn layout_captions_at( &mut self, indices: &[usize], base_x: i32, y: i32, width: i32, ) -> i32
indices で指定した caption 群を y から順に縦積みでレイアウトし、消費した合計高さを返す。
caption-side:top(既定)/bottom どちらの配置にも使う共通ヘルパー。
pub(crate) fn layout(&mut self, containing_block: Dimensions)
fn is_virgin_box(&self) -> bool
fn can_memo_subtree(&self) -> bool
pub fn subtree_box_count(&self) -> usize
fn collect_memo_boxes(&self, out: &mut Vec<(Dimensions, bool)>)
fn apply_memo_boxes( &mut self, boxes: &[(Dimensions, bool)], idx: &mut usize, dx: i32, dy: i32, ) -> bool
fn try_apply_layout_memo( &mut self, key: &LayoutMemoKey, cb_x: i32, cb_y_flow: i32, ) -> bool
fn store_layout_memo(&self, key: LayoutMemoKey, cb_x: i32, cb_y_flow: i32)
fn layout_fg_item(&mut self, containing_block: Dimensions)
fn layout_inner(&mut self, containing_block: Dimensions, is_fg_item: bool)
Sourcefn establish_abs_cb(
&self,
) -> (Option<(i32, i32, i32, i32)>, Option<Option<(i32, i32, i32, i32)>>)
fn establish_abs_cb( &self, ) -> (Option<(i32, i32, i32, i32)>, Option<Option<(i32, i32, i32, i32)>>)
この要素が包含ブロックを作る(位置指定、または transform/filter/contain:paint 等)なら、
子孫 absolute(および transform 等なら fixed)の包含ブロックを self のパディング箱に切替え、
切替前の値を返す。戻り値は restore_abs_cb に渡して復元する。
content.width / content.height が確定済みであることを前提とする(bottom/right 解決のため)。
Sourcefn restore_abs_cb(
saved: (Option<(i32, i32, i32, i32)>, Option<Option<(i32, i32, i32, i32)>>),
)
fn restore_abs_cb( saved: (Option<(i32, i32, i32, i32)>, Option<Option<(i32, i32, i32, i32)>>), )
establish_abs_cb の戻り値を使って ABS_CB / FIXED_CB を元に戻す。
Sourcepub(crate) fn child_is_out_of_flow(child: &LayoutBox<'_>) -> bool
pub(crate) fn child_is_out_of_flow(child: &LayoutBox<'_>) -> bool
子のうち out-of-flow(absolute / fixed)なものを判定するヘルパ。
Sourcefn apply_positioned_offsets(&mut self)
fn apply_positioned_offsets(&mut self)
position 後処理。全フォーマッティングコンテキスト(block/flex/grid/table)で共有。
- relative: フロー確定位置から top/left(または bottom/right の符号反転)でオフセット。
- absolute: 最近傍 positioned 祖先(ABS_CB、昇り解決済み)基準で top/left/right/bottom 配置。
- fixed: ビューポート原点基準で配置。
- transform: translate を最後に視覚シフトとして適用(兄弟は再フローしない=仕様通り)。
self.dimensions.content.{width,height} が確定済みであることを前提とする。
Sourcefn apply_positioned_offsets_with(
&mut self,
abs_areas: Option<&[Option<(i32, i32, i32, i32)>]>,
static_from_flow: bool,
)
fn apply_positioned_offsets_with( &mut self, abs_areas: Option<&[Option<(i32, i32, i32, i32)>]>, static_from_flow: bool, )
apply_positioned_offsets の本体。abs_areas[i] があれば i 番目の子の absolute の
包含ブロックとして使う(grid コンテナが包含ブロックのとき、グリッドエリアが基準になる)。
fn apply_positioned_offsets_grid( &mut self, abs_areas: Option<&[Option<(i32, i32, i32, i32)>]>, rel_cell_sizes: Option<&[Option<(i32, i32)>]>, static_from_flow: bool, )
fn prepare_child_subgrid_ctx( child: &LayoutBox<'_>, col_widths: &[i32], col_gap_eff: i32, c: usize, cs: usize, cell_w: i32, ) -> Option<SubgridContext>
Sourcefn grid_fit_outer_width(
child: &LayoutBox<'_>,
cell_w: i32,
justify: &str,
) -> Option<i32>
fn grid_fit_outer_width( child: &LayoutBox<'_>, cell_w: i32, justify: &str, ) -> Option<i32>
グリッドアイテムの justify-self が stretch 以外で幅が auto のとき、アイテムは
セル幅を埋めず fit-content(min(max-content, max(min-content, セル幅)))になる
(CSS Box Alignment §6.2・Grid §6.2)。配置済みの子のその外側幅を返す。
置換要素・明示幅・縦書き・aspect-ratio 付きは対象外(None)。
fn layout_grid(&mut self, containing_block: Dimensions)
Sourcepub fn resolve_grid_computed_tracks(
&mut self,
containing_block: Dimensions,
) -> Option<(String, String)>
pub fn resolve_grid_computed_tracks( &mut self, containing_block: Dimensions, ) -> Option<(String, String)>
grid-template-columns / grid-template-rows の解決済みトラックリストを返す(WPT / getComputedStyle 用)。
fn layout_grid_impl( &mut self, containing_block: Dimensions, resolved_out: Option<&mut (String, String)>, )
Sourcefn grid_col_contrib(child: &LayoutBox<'_>) -> (i32, i32, i32, i32, bool)
fn grid_col_contrib(child: &LayoutBox<'_>) -> (i32, i32, i32, i32, bool)
グリッドアイテムの列軸の寄与 (min-content, max-content, 自動最小, 外縁, 自動最小クランプ禁止)。
Sourcefn grid_row_auto_min(child: &LayoutBox<'_>, h: f32, non_content: i32) -> f32
fn grid_row_auto_min(child: &LayoutBox<'_>, h: f32, non_content: i32) -> f32
行軸の自動最小(スクロールコンテナは 0、min-height の指定があればそれ)。
Sourcefn logical_auto_margins(child: &LayoutBox<'_>, logical_x: bool) -> (bool, bool)
fn logical_auto_margins(child: &LayoutBox<'_>, logical_x: bool) -> (bool, bool)
現在の世界 CUR_WORLD における論理辺ペアの margin が auto か。
logical_x = true: (left, right), false: (top, bottom)。
Sourcefn h_auto_margins(child: &LayoutBox<'_>) -> (bool, bool)
fn h_auto_margins(child: &LayoutBox<'_>) -> (bool, bool)
論理左右(インライン軸)の margin が auto か。
Sourcefn v_auto_margins(child: &LayoutBox<'_>) -> (bool, bool)
fn v_auto_margins(child: &LayoutBox<'_>) -> (bool, bool)
論理上下(ブロック軸)の margin が auto か。
Sourcefn grid_justify(
child: &LayoutBox<'_>,
self_prop: &str,
items_default: &str,
rtl: bool,
) -> &'static str
fn grid_justify( child: &LayoutBox<'_>, self_prop: &str, items_default: &str, rtl: bool, ) -> &'static str
justify-self / justify-items の解決。
Sourcefn grid_raw_align<'b>(child: &LayoutBox<'b>, items_default: &'b str) -> &'b str
fn grid_raw_align<'b>(child: &LayoutBox<'b>, items_default: &'b str) -> &'b str
アイテムの align-self(auto/未指定ならコンテナの align-items)の生の値。
Sourcefn has_pct_height(child: &LayoutBox<'_>) -> bool
fn has_pct_height(child: &LayoutBox<'_>) -> bool
height / min-height / max-height に % を使っているか。
fn layout_table(&mut self, containing_block: Dimensions)
fn layout_flex(&mut self, containing_block: Dimensions)
Sourcefn layout_flex_wrapped(
&mut self,
is_row: bool,
is_reverse: bool,
wrap_reverse: bool,
justify_content: &str,
align_items: &str,
align_content: &str,
gap_main: i32,
gap_cross: i32,
height_val: Option<&str>,
explicit_h: Option<i32>,
min_h: Option<i32>,
max_h: Option<i32>,
)
fn layout_flex_wrapped( &mut self, is_row: bool, is_reverse: bool, wrap_reverse: bool, justify_content: &str, align_items: &str, align_content: &str, gap_main: i32, gap_cross: i32, height_val: Option<&str>, explicit_h: Option<i32>, min_h: Option<i32>, max_h: Option<i32>, )
flex-wrap: wrap / wrap-reverse のレイアウト。 子を主軸に沿って並べ、コンテナ主軸長を超えたら次の行へ折り返す。 各行ごとに justify-content(主軸)と align-items / align-self(交差軸)を適用する。
fn layout_block(&mut self, containing_block: Dimensions, is_fg_item: bool)
Sourcefn intrinsic_inline_size_ext(&self, avail_hint: i32, pure: bool) -> (i32, i32)
fn intrinsic_inline_size_ext(&self, avail_hint: i32, pure: bool) -> (i32, i32)
avail_hint: 包含ブロックのコンテンツ幅。テキスト折り返し計測に使う。
(以前は固定 800px フォールバックだったため、実コンテナ幅と食い違い
layout の行数 < flatten の行数 となって後続要素と重なるバグがあった)
内容ベースの寸法を返す。avail_hint は折り返しに使える幅。
pure が真なら現在の箱の幅を見ない。内在幅
(min-content / max-content)の算出専用の入口で、
block_intrinsic_widths だけが真を渡す。
内在幅は「今どう組まれているか」に依存してはいけない値だが、 この関数は内在幅以外の用途(表の列幅・インライン配置など)でも 呼ばれており、そちらは現在の幅を前提にしている。 【2026-09-05】一度この区別をせずに順序だけ入れ替えたところ、 ヒーローの見出しが 2 行に折り返す退行を招いて戻した。 入口を分けることで、内在幅の算出だけを正す。
fn intrinsic_inline_size_ext_uncached( &self, avail_hint: i32, pure: bool, ) -> (i32, i32)
Sourcefn intrinsic_inline_size(&self, avail_hint: i32) -> (i32, i32)
fn intrinsic_inline_size(&self, avail_hint: i32) -> (i32, i32)
従来どおりの入口(現在の箱の幅を見る)。
fn layout_inline(&mut self, containing_block: Dimensions, _block_like: bool)
Sourcefn finalize_inline_line_vertical_align(
&mut self,
start: usize,
end: usize,
line_h: i32,
max_w: i32,
)
fn finalize_inline_line_vertical_align( &mut self, start: usize, end: usize, line_h: i32, max_w: i32, )
インラインの1行ぶん([start, end) の子要素)に vertical-align を適用する。
簡略化: top/baseline/sub/super/text-top はいずれも無調整(top相当)、
middle は行の中央、bottom/text-bottom は行の下端に揃える。table セルの
vertical-align(内容のみシフト)とは異なり、ここでは子要素自身(背景/境界線含む)を
まるごとシフトする(インラインボックス自体の行内配置を変えるのが目的のため)。
Sourcefn resolve_sizing_value(&self, value: Option<&str>, base: i32) -> Option<i32>
fn resolve_sizing_value(&self, value: Option<&str>, base: i32) -> Option<i32>
min-width/max-width 等のサイジング値を解決する。px/% は base 基準、
min-content/max-content/fit-content は内容計測で解決。auto/未指定は None。
Sourcefn basis_with_auto_min(&self, basis: i32) -> i32
fn basis_with_auto_min(&self, basis: i32) -> i32
flex-basis が中身の幅(min-width: auto の自動最小サイズ)を下回らないようにする
(CSS Flexbox L1 §4.5。仮のサイズは下限で止まる)。overflow が visible 以外なら下限は 0。
YouTube の #owner は flex-basis: 0.000000001px で、潰れて隣の列と重なっていた(2026-11-01)。
計測は重いので、今の幅より小さくなるときだけ測る。
Sourcefn basis_with_auto_min_h(&self, basis: i32, definite_h: Option<i32>) -> i32
fn basis_with_auto_min_h(&self, basis: i32, definite_h: Option<i32>) -> i32
basis_with_auto_min の、交差軸の高さが確定しているとき(単一行・高さ確定のコンテナで stretch される項目)の版。
最小内容幅をその高さで測る(中の height:100% の canvas 等が縮む。WPT css-flexbox flex-item-percentage-height-img-001:
flex-basis: 0 の項目の下限が canvas の本来の幅 400 で測られ 410px になっていた。正しくは 200px)。
Sourcefn grow_auto_min(&self) -> i32
fn grow_auto_min(&self) -> i32
伸びるアイテムの下限(min-width: auto の自動最小サイズ)。
Sourcepub(crate) fn block_intrinsic_widths(&self) -> (i32, i32)
pub(crate) fn block_intrinsic_widths(&self) -> (i32, i32)
ブロック要素の内容ベース幅を返す: (min_content, max_content)。 max_content = 折返しなしの最大行幅、min_content = 最大限折返したときの最小幅。 直下の子(inline/text/block)を計測して集約する。
Sourcefn block_intrinsic_widths_with_h(&self, definite_h: Option<i32>) -> (i32, i32)
fn block_intrinsic_widths_with_h(&self, definite_h: Option<i32>) -> (i32, i32)
ブロック要素の内容ベース幅を definite_h(交差軸 stretch 等で確定した高さ)付きで測る。
Sourcefn subtree_has_text_or_replaced(&self) -> bool
fn subtree_has_text_or_replaced(&self) -> bool
テキストや置換要素、明示幅指定などの実質的な内在幅要素をサブツリーに含むか。
Sourcefn block_child_intrinsic_with_ratio(
child: &LayoutBox<'_>,
pct_base_h: i32,
) -> (i32, i32, bool)
fn block_child_intrinsic_with_ratio( child: &LayoutBox<'_>, pct_base_h: i32, ) -> (i32, i32, bool)
ブロックレベルの子の内在幅を計測する(aspect-ratio + 解決可能な高さにも対応)。
fn block_intrinsic_widths_uncached(&self) -> (i32, i32)
Sourcefn column_wrap_intrinsic_widths(
&self,
node: &StyledNode<'_>,
) -> Option<(i32, i32)>
fn column_wrap_intrinsic_widths( &self, node: &StyledNode<'_>, ) -> Option<(i32, i32)>
flex-flow: column wrap の内在幅。高さの制約(height / max-height / min-height)で項目を列へ
詰め、各列の最大の項目幅の合計 + 列間 gap を返す。高さが確定しなければ None(汎用計測へ)。
Sourcefn grid_container_intrinsic_widths(&self, node: &StyledNode<'_>) -> (i32, i32)
fn grid_container_intrinsic_widths(&self, node: &StyledNode<'_>) -> (i32, i32)
グリッドコンテナの内在幅 (min-content, max-content)(CSS Grid §11.1・列のトラックサイズ決定を
min-content / max-content 制約で走らせ、トラックの合計 + 溝)。% や auto-fill は確定幅が
無いので 1 回の繰り返し・auto 扱い。
Sourcepub(crate) fn children_intrinsic_widths(&self) -> (i32, i32)
pub(crate) fn children_intrinsic_widths(&self) -> (i32, i32)
子の内在幅を集約する(ブロックとしての中身。インラインの子は同じ行に並ぶので max は加算・ min は最大、ブロックの子は縦に積むので両方とも最大)。
fn children_intrinsic_widths_inner( &self, explicit_dh: Option<i32>, ) -> (i32, i32)
fn inline_content_intrinsic_size(&self, available_width: i32) -> (i32, i32)
fn inline_content_intrinsic_size_uncached( &self, available_width: i32, ) -> (i32, i32)
fn is_inline_line_break(&self) -> bool
fn apply_box_model_styles_with_base(&mut self, containing_width: i32)
fn apply_box_model_styles(&mut self)
Source§impl<'a> LayoutBox<'a>
impl<'a> LayoutBox<'a>
Sourcepub(crate) fn orthogonal_intrinsic_widths(&self, p: u8, c: u8) -> (i32, i32)
pub(crate) fn orthogonal_intrinsic_widths(&self, p: u8, c: u8) -> (i32, i32)
向きの違う箱の内在幅(親の世界での min/max-content)。orthogonal flow の物理的な幅は 箱の block サイズで、inline サイズ(= 親から見た高さ)に対して一意に決まるため min = max。
Sourcepub(crate) fn world_node(&self) -> Option<&'a StyledNode<'a>>
pub(crate) fn world_node(&self) -> Option<&'a StyledNode<'a>>
世界の切り替えを担う箱(block / flex / grid の要素)の StyledNode。
Sourcefn convert_world(&mut self, c: u8, p: u8, ext: (i32, i32))
fn convert_world(&mut self, c: u8, p: u8, ext: (i32, i32))
部分木の全矩形と縁を世界 c から p へ写す(外形 ext は根のマージン箱)。
Sourcepub(crate) fn layout_other_world(&mut self, cb: Dimensions, p: u8, c: u8)
pub(crate) fn layout_other_world(&mut self, cb: Dimensions, p: u8, c: u8)
親の世界 p と違う世界 c の箱を組む(CSS Writing Modes §7.3 の orthogonal flow を含む)。
Source§impl<'a> LayoutBox<'a>
impl<'a> LayoutBox<'a>
Sourcepub(crate) fn first_baseline_in_content(&self) -> Option<i32>
pub(crate) fn first_baseline_in_content(&self) -> Option<i32>
自身の content 箱の上端からの first baseline(流れの中の最初の行の基準線。無ければ None)。
Sourcepub(crate) fn first_baseline_in_content_dir(
&self,
lr_sideways: bool,
) -> Option<i32>
pub(crate) fn first_baseline_in_content_dir( &self, lr_sideways: bool, ) -> Option<i32>
lr_sideways = true のときは vertical-lr 縦書き用に 1行目上端から ch - ascent(descent 側)を返す。
Sourcefn first_inflow_text_box(&self) -> Option<(i32, i32, i32, i32, i32)>
fn first_inflow_text_box(&self) -> Option<(i32, i32, i32, i32, i32)>
直交または縦書き要素の 1行目テキストの (content左端からのx, content上端からのy, 幅, 高さ, ascent) を探す。
Sourcepub(crate) fn grid_first_baseline(&self) -> Option<i32>
pub(crate) fn grid_first_baseline(&self) -> Option<i32>
グリッドコンテナ自身の first baseline(content-box 上端からの距離。CSS Grid §6.1)。
Sourcepub(crate) fn item_baseline_from_margin_top(&self) -> i32
pub(crate) fn item_baseline_from_margin_top(&self) -> i32
マージン箱の上端から first baseline までの距離(flex / grid アイテム用)。
Sourcepub(crate) fn item_grid_baseline(&self, container_world: u8) -> i32
pub(crate) fn item_grid_baseline(&self, container_world: u8) -> i32
グリッドアイテムの行軸(align-items/self: baseline)ベースライン(マージン箱論理上端からの距離)。
縦書きおよび直交アイテムの合成ベースライン(CSS Align 3 §9.1)を扱う。
Sourcepub(crate) fn item_col_baseline(&self, container_world: u8) -> (u8, i32)
pub(crate) fn item_col_baseline(&self, container_world: u8) -> (u8, i32)
グリッドアイテムの列軸(justify-items/self: baseline)の (グループ番号, 基準位置)。
grp = 0: 論理左端基準、grp = 1: 右端基準(横書き内の vertical-rl 等)。