A child pinned with bottom: 0 can end a pixel above its parent's bottom after pixel rounding
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
Start with PixelGrid.cpp and the roundLayoutResultsToPixelGrid logic described in the issue. Review draft PR #2068 and the gentest position rounding and generated expectations it identifies. Done means bottom-pinned children align with the parent after rounding, text positions avoid cumulative drift, and the reported gentest expectations are updated.
索引モデルが issue の本文から書いたものです。
説明
- I have searched existing issues and this is not a duplicate
Summary
roundLayoutResultsToPixelGrid: position rounded from relative offset (nodeTop), size from absolute edges (round(absoluteNodeBottom) - round(absoluteNodeTop)).- Parent on a fractional pixel → child pinned
bottom: 0ends 1 px above parent's bottom.
Repro
yoga-layout 3.2.1; PixelGrid.cpp on main rounds the same way.
import Yoga, { Edge, PositionType } from "yoga-layout";
const config = Yoga.Config.create();
config.setPointScaleFactor(1);
const root = Yoga.Node.create(config);
root.setWidth(100);
const parent = Yoga.Node.create(config);
parent.setPositionType(PositionType.Absolute);
parent.setPosition(Edge.Top, 0.25);
parent.setWidth(100);
parent.setHeight(10.5);
const child = Yoga.Node.create(config);
child.setPositionType(PositionType.Absolute);
child.setPosition(Edge.Bottom, 0);
child.setWidth(100);
child.setHeight(10.25);
parent.insertChild(child, 0);
root.insertChild(parent, 0);
root.calculateLayout(undefined, undefined);
parent.getComputedLayout(); // { top: 0, height: 11 }
child.getComputedLayout(); // { top: 0, height: 10 } -> bottom 10, parent bottom 11
- Expected: child
top: 1, height: 10, flush with parent bottom. - Actual: 1 px gap.
Why
- Child absolute edges 0.5 / 10.75 → rounded 1 / 11 → height 10.
- Position:
round(0.25) = 0, notround(0.5) - round(0.25) = 1.
Scale
- Scale 2.25 (Pixel 8 Pro), parent 506 tall at offset 0–4,
bottom: 0child 150–260 tall: 2003 / 9176 layouts 1 px short. top: 0; bottom: 0child: 0 / 9176.- Seen in React Native 0.88, Android: card shade
bottom: 0stops 1 px above the card edge, image line shows.
Related
- #1574: rounding is meant to avoid gaps between touching edges. This is one.
Possible fix
- Non-text position:
round(absoluteNodeTop) - round(absoluteTop)(same for left), reusing the rounded leading edge of the size. - Text nodes keep floored relative position: absolute flooring drifts text 1 px per relayout.
- gentest reads positions with the same relative rounding (
Math.round(rect.top - parentTop)); change it too. 2 generated expectations move. - Draft PR: #2068.
Written with help from Claude (AI); reviewed and tested by me.
- 主要言語
- C++
- スター
- 18.9k
- フォーク
- 1.6k
- 平均マージ
- 1日 31分
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react/yoga のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Measured nodes in a cached subtree grow by a rounding step on every layout pass対応中かも @salmanmkc が 7 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Auto cross axis margins are ignored in wrapping containers and baseline rows対応中かも @sorinc03 が 5 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
xiaoyifang/goldendict-ng#3148 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
triton-inference-server/server#9069 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 4 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100