Skip to main contentModule shorthand
Source - apply_text_transform
text-transform を適用する(uppercase / lowercase / capitalize)。- expand_background_shorthand 🔒
background ショートハンド(background: url(...) center/cover no-repeat 等)から
background-position/background-size/background-repeat を抜き出し、明示的な
longhand 指定が無い場合のみカスケード時点で補う。- expand_border_shorthands 🔒
- expand_font_shorthand 🔒
font: [style] [weight] size[/line-height] family-list ショートハンドを
font-style/font-weight/font-size/line-height/font-family へ展開する。
簡略化: font-variant(small-caps 等)と font-stretch は longhand の消費側が
存在しないため読み飛ばす(値としては無視するだけで、パース自体は失敗させない)。
caption/icon/menu/message-box/small-caption/status-bar のシステムフォント
キーワードは非対応のため素通りする。対応する longhand が既に指定されていればそちらを
優先する(.entry().or_insert() パターン、他のショートハンド展開関数と同じ方針)。- expand_grid_template_shorthand 🔒
grid-template: <rows> / <columns> および grid-template-areas を含む記法
("a a" 1fr "b c" 1fr / 1fr 2fr のようにエリア名の文字列リテラルと行トラック
サイズが交互に並び、任意で / <columns> が続く)を展開する。
エリア名部分はそのまま grid-template-areas へ、文字列リテラルを取り除いた
残りのトークンを grid-template-rows へ、/ 以降を grid-template-columns へ
展開する。対応する longhand が既に指定されていればそちらを優先する。- expand_logical_box_shorthands 🔒
margin-block/margin-inline/padding-block/padding-inline/inset-block/
inset-inline(1〜2値。1番目が start、2番目(省略時は1番目と同値)が end)を
-start/-end の longhand へ展開する。既に longhand 側が個別指定されていれば
そちらを優先し、shorthand 側は無視する(resolve_logical_properties の
「物理プロパティが既にあれば論理プロパティを無視する」規則と同じ優先順位の考え方)。- expand_place_shorthands 🔒
place-items/place-content/place-self(align-*/justify-* を1行にまとめる
ショートハンド)を展開する。place-x: A は align-x:A; justify-x:A、
place-x: A B は align-x:A; justify-x:B となる。対応する longhand が既に
指定されていればそちらを優先し、ショートハンドでは上書きしない。- expand_text_emphasis_shorthand 🔒
text-emphasis: [<style>] [<color>] ショートハンドを text-emphasis-style/
text-emphasis-color へ展開する。filled/open の fill キーワードは非対応で
読み飛ばす(常に塗りつぶし形状として扱う簡略実装)。- parse_border_shorthand 🔒
- replace_ignore_case 🔒
- 大文字小文字を無視して
from を to へすべて置換する(str::replace は大小文字を
区別するため使えない)。currentColor/currentcolor/CURRENTCOLOR 等の表記ゆれに対応する。 - resolve_all_shorthand 🔒
all: unset/initial/revert(すべてのプロパティを一括リセットするショートハンド)を解決する。
簡略化: 本来はカスケードの中で all より後に書かれた個別プロパティだけが生き残るが、
この処理系はプロパティ名ごとに独立してカスケード解決した後の specified_values しか
見えないため、そこまで厳密な順序判定はできない。実用上ほとんどの利用パターン
(.reset{all:unset} のように単独で使う)をカバーする近似として、all が
CSS-wide keyword なら、カスタムプロパティ(-- 始まり)と all 自身を除く
全プロパティを削除する。- resolve_current_color 🔒
currentColor キーワードを、この要素で確定した color の値に置換する。
color 自身の継承伝搬が終わった直後(呼び出し元で保証)に実行する必要がある。
color プロパティ自体は対象外(color:currentColor は無限自己参照になるため触らない)。- resolve_logical_properties 🔒
- CSS 論理プロパティ(
margin-inline-start 等)を物理プロパティ(margin-left 等)へ
変換する。この処理系は縦書き(writing-mode)に対応していないため、block 軸は常に
縦方向・inline 軸は常に横方向として扱う簡略実装。direction:rtl の場合のみ
inline-start/end を right/left(既定は left/right)へ入れ替える。
対応する物理プロパティが既に指定されている場合は論理プロパティを無視する
(同じ要素内で両方書かれた場合、物理プロパティを優先する簡易な優先順位)。 - strip_css_wide_keywords 🔒
- CSS-wide keywords(
initial/inherit/unset/revert)を持つプロパティを
specified_values から取り除く。取り除いた後の挙動: - strip_quoted_segments 🔒
- 文字列リテラル(
"..."/'...')区間をすべて取り除き、残ったトークンを空白区切りで
連結して返す。grid-template の "area row" 1fr "area row" 2fr のような
エリア名と行トラックサイズが交互に並ぶ記法から、トラックサイズだけを取り出すのに使う。