Bug 1887465 - Use the containing block's writing mode to resolve logical values for CSS float and clear properties. r=layout-reviewers,emilio

And don't resolve them prematurely; the computed value should remain
logical, and only be mapped to physical sides at use time.

Differential Revision: https://phabricator.services.mozilla.com/D229998
This commit is contained in:
Jonathan Kew
2024-11-25 14:02:26 +00:00
parent 32d924bc93
commit 64fa9b6bb6
21 changed files with 165 additions and 245 deletions

View File

@@ -6158,7 +6158,8 @@ void nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aClearType) {
for (const FloatInfo& floatInfo : mFloats) {
const nsStyleDisplay* floatDisp = floatInfo.Frame()->StyleDisplay();
StyleClear clearType = floatDisp->mClear;
auto cbWM = floatInfo.Frame()->GetParent()->GetWritingMode();
StyleClear clearType = floatDisp->UsedClear(cbWM);
if (clearType == StyleClear::Left || clearType == StyleClear::Right ||
clearType == StyleClear::Both) {
nscoord floatsCur = NSCoordSaturatingAdd(floatsCurLeft, floatsCurRight);
@@ -6173,7 +6174,7 @@ void nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aClearType) {
}
}
StyleFloat floatStyle = floatDisp->mFloat;
StyleFloat floatStyle = floatDisp->UsedFloat(cbWM);
nscoord& floatsCur =
floatStyle == StyleFloat::Left ? floatsCurLeft : floatsCurRight;
nscoord floatISize = floatInfo.ISize();
@@ -6207,7 +6208,8 @@ void nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aClearType) {
// no longer any floats we need to keep. See below.
for (FloatInfo& floatInfo : Reversed(mFloats)) {
const nsStyleDisplay* floatDisp = floatInfo.Frame()->StyleDisplay();
if (floatDisp->mFloat != clearFloatType) {
auto cbWM = floatInfo.Frame()->GetParent()->GetWritingMode();
if (floatDisp->UsedFloat(cbWM) != clearFloatType) {
newFloats.AppendElement(floatInfo);
} else {
// This is a float on the side that this break directly clears
@@ -6217,7 +6219,7 @@ void nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aClearType) {
// (earlier) floats on that side would be indirectly cleared
// as well. Thus, we should break out of this loop and stop
// considering earlier floats to be kept in mFloats.
StyleClear clearType = floatDisp->mClear;
StyleClear clearType = floatDisp->UsedClear(cbWM);
if (clearType != aClearType && clearType != StyleClear::None) {
break;
}