Backed out changeset 11ba57726279 (bug 1812679) for causing Wr failures on text-combine-upright-value-all-002.html

This commit is contained in:
Norisz Fay 2023-03-24 01:51:06 +02:00
Родитель eb7653efa4
Коммит 97050950be
26 изменённых файлов: 115 добавлений и 99 удалений

Просмотреть файл

@ -8591,10 +8591,8 @@ void nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame,
// The height of our box is the sum of our font size plus the top
// and bottom border and padding. The height of children do not
// affect our height.
aMetrics.SetBlockStartAscent(
aLineWM.IsAlphabeticalBaseline()
? aLineWM.IsLineInverted() ? fm->MaxDescent() : fm->MaxAscent()
: fm->MaxHeight() / 2);
aMetrics.SetBlockStartAscent(aLineWM.IsLineInverted() ? fm->MaxDescent()
: fm->MaxAscent());
aMetrics.BSize(aLineWM) = fm->MaxHeight();
} else {
NS_WARNING("Cannot get font metrics - defaulting sizes to 0");

Просмотреть файл

@ -103,10 +103,6 @@ Maybe<nscoord> nsCheckboxRadioFrame::GetNaturalBaselineBOffset(
return Nothing{};
}
if (aWM.IsCentralBaseline()) {
return Some(GetLogicalUsedBorderAndPadding(aWM).BStart(aWM) +
ContentSize(aWM).BSize(aWM) / 2);
}
// This is for compatibility with Chrome, Safari and Edge (Dec 2016).
// Treat radio buttons and checkboxes as having an intrinsic baseline
// at the block-end of the control (use the block-end content edge rather

Просмотреть файл

@ -300,9 +300,7 @@ void nsHTMLButtonControlFrame::ReflowButtonContents(
// XXX is there a better strategy? should we include border-padding?
if (!aButtonReflowInput.mStyleDisplay->IsContainLayout()) {
if (aButtonDesiredSize.GetWritingMode().IsOrthogonalTo(wm)) {
aButtonDesiredSize.SetBlockStartAscent(
wm.IsAlphabeticalBaseline() ? contentsDesiredSize.ISize(wm)
: contentsDesiredSize.ISize(wm) / 2);
aButtonDesiredSize.SetBlockStartAscent(contentsDesiredSize.ISize(wm));
} else {
aButtonDesiredSize.SetBlockStartAscent(
contentsDesiredSize.BlockStartAscent() + childPos.B(wm));

Просмотреть файл

@ -1456,32 +1456,16 @@ static void GetScrollableOverflowForPerspective(
}
}
BaselineSharingGroup nsHTMLScrollFrame::GetDefaultBaselineSharingGroup() const {
return mScrolledFrame->GetDefaultBaselineSharingGroup();
}
nscoord nsHTMLScrollFrame::SynthesizeFallbackBaseline(
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
// Marign-end even for central baselines.
if (aWM.IsLineInverted()) {
return -GetLogicalUsedMargin(aWM).BStart(aWM);
}
return aBaselineGroup == BaselineSharingGroup::First
? BSize(aWM) + GetLogicalUsedMargin(aWM).BEnd(aWM)
: -GetLogicalUsedMargin(aWM).BEnd(aWM);
}
Maybe<nscoord> nsHTMLScrollFrame::GetNaturalBaselineBOffset(
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
// Block containers that are scrollable always have a last baseline
// Block containers that are scrollable always have a first & last baselines
// that are synthesized from block-end margin edge.
// Note(dshin): This behaviour is really only relevant to `inline-block`
// alignment context. In the context of table/flex/grid alignment, first/last
// baselines are calculated through `GetFirstLineBaseline`, which does
// calculations of its own.
// https://drafts.csswg.org/css-align/#baseline-export
if (aBaselineGroup == BaselineSharingGroup::Last &&
mScrolledFrame->IsBlockFrameOrSubclass()) {
if (mScrolledFrame->IsBlockFrameOrSubclass()) {
return Some(SynthesizeFallbackBaseline(aWM, aBaselineGroup));
}

Просмотреть файл

@ -129,10 +129,6 @@ class nsHTMLScrollFrame : public nsContainerFrame,
bool ComputeCustomOverflow(mozilla::OverflowAreas& aOverflowAreas) final;
BaselineSharingGroup GetDefaultBaselineSharingGroup() const override;
nscoord SynthesizeFallbackBaseline(
mozilla::WritingMode aWM,
BaselineSharingGroup aBaselineGroup) const override;
Maybe<nscoord> GetNaturalBaselineBOffset(
mozilla::WritingMode aWM,
BaselineSharingGroup aBaselineGroup) const override;

Просмотреть файл

@ -2113,9 +2113,6 @@ nscoord nsIFrame::SynthesizeFallbackBaseline(
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
const auto margin = GetLogicalUsedMargin(aWM);
NS_ASSERTION(!IsSubtreeDirty(), "frame must not be dirty");
if (aWM.IsCentralBaseline()) {
return (BSize(aWM) + GetLogicalUsedMargin(aWM).BEnd(aWM)) / 2;
}
// Baseline for inverted line content is the top (block-start) margin edge,
// as the frame is in effect "flipped" for alignment purposes.
if (aWM.IsLineInverted()) {

Просмотреть файл

@ -1346,9 +1346,7 @@ void nsLineLayout::PlaceFrame(PerFrameData* pfd, ReflowOutput& aMetrics) {
// its ascent; instead, treat it as a block with baseline at the block-end
// edge (or block-begin in the case of an "inverted" line).
if (pfd->mWritingMode.GetBlockDir() != lineWM.GetBlockDir()) {
pfd->mAscent = lineWM.IsAlphabeticalBaseline()
? lineWM.IsLineInverted() ? 0 : aMetrics.BSize(lineWM)
: aMetrics.BSize(lineWM) / 2;
pfd->mAscent = lineWM.IsLineInverted() ? 0 : aMetrics.BSize(lineWM);
} else {
if (aMetrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
pfd->mAscent = pfd->mFrame->GetLogicalBaseline(lineWM);
@ -2016,7 +2014,25 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
switch (keyword) {
default:
case StyleVerticalAlignKeyword::Baseline:
pfd->mBounds.BStart(lineWM) = revisedBaselineBCoord - pfd->mAscent;
if (lineWM.IsVertical() && !lineWM.IsSideways()) {
// FIXME: We should really use a central baseline from the
// baseline table of the font, rather than assuming it's in
// the middle.
if (frameSpan) {
nscoord borderBoxBSize = pfd->mBounds.BSize(lineWM);
nscoord bStartBP = pfd->mBorderPadding.BStart(lineWM);
nscoord bEndBP = pfd->mBorderPadding.BEnd(lineWM);
nscoord contentBoxBSize = borderBoxBSize - bStartBP - bEndBP;
pfd->mBounds.BStart(lineWM) =
revisedBaselineBCoord - contentBoxBSize / 2 - bStartBP;
} else {
pfd->mBounds.BStart(lineWM) = revisedBaselineBCoord -
logicalBSize / 2 +
pfd->mMargin.BStart(lineWM);
}
} else {
pfd->mBounds.BStart(lineWM) = revisedBaselineBCoord - pfd->mAscent;
}
pfd->mBlockDirAlign = VALIGN_OTHER;
break;
@ -2136,7 +2152,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
// inverted relative to block direction.
nscoord revisedBaselineBCoord =
baselineBCoord - offset * lineWM.FlowRelativeToLineRelativeFactor();
if (lineWM.IsCentralBaseline()) {
if (lineWM.IsVertical() && !lineWM.IsSideways()) {
// If we're using a dominant center baseline, we align with the center
// of the frame being placed (bug 1133945).
pfd->mBounds.BStart(lineWM) =

Просмотреть файл

@ -9292,21 +9292,14 @@ void nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
finalSize.ISize(wm) =
NSToCoordCeilClamped(std::max(gfxFloat(0.0), textMetrics.mAdvanceWidth));
nscoord fontBaseline;
// Note(dshin): Baseline should tecnhically be halfway through the em box for
// a central baseline. It is simply half of the text run block size so that it
// can be easily calculated in `GetNaturalBaselineBOffset`.
if (transformedCharsFit == 0 && !usedHyphenation) {
aMetrics.SetBlockStartAscent(0);
finalSize.BSize(wm) = 0;
fontBaseline = 0;
} else if (boundingBoxType != gfxFont::LOOSE_INK_EXTENTS) {
fontBaseline = NSToCoordCeil(textMetrics.mAscent);
const auto size = fontBaseline + NSToCoordCeil(textMetrics.mDescent);
// Use actual text metrics for floating first letter frame.
aMetrics.SetBlockStartAscent(wm.IsAlphabeticalBaseline() ? fontBaseline
: size / 2);
finalSize.BSize(wm) = size;
aMetrics.SetBlockStartAscent(NSToCoordCeil(textMetrics.mAscent));
finalSize.BSize(wm) =
aMetrics.BlockStartAscent() + NSToCoordCeil(textMetrics.mDescent);
} else {
// Otherwise, ascent should contain the overline drawable area.
// And also descent should contain the underline drawable area.
@ -9316,18 +9309,16 @@ void nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
wm.IsLineInverted() ? fm->MaxDescent() : fm->MaxAscent();
nscoord fontDescent =
wm.IsLineInverted() ? fm->MaxAscent() : fm->MaxDescent();
fontBaseline = std::max(NSToCoordCeil(textMetrics.mAscent), fontAscent);
const auto size =
fontBaseline +
aMetrics.SetBlockStartAscent(
std::max(NSToCoordCeil(textMetrics.mAscent), fontAscent));
nscoord descent =
std::max(NSToCoordCeil(textMetrics.mDescent), fontDescent);
aMetrics.SetBlockStartAscent(wm.IsAlphabeticalBaseline() ? fontBaseline
: size / 2);
finalSize.BSize(wm) = size;
finalSize.BSize(wm) = aMetrics.BlockStartAscent() + descent;
}
if (Style()->IsTextCombined()) {
nsFontMetrics* fm = provider.GetFontMetrics();
nscoord width = finalSize.ISize(wm);
nscoord em = fm->EmHeight();
gfxFloat width = finalSize.ISize(wm);
gfxFloat em = fm->EmHeight();
// Compress the characters in horizontal axis if necessary.
if (width <= em) {
RemoveProperty(TextCombineScaleFactorProperty());
@ -9337,9 +9328,8 @@ void nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
}
// Make the characters be in an 1em square.
if (finalSize.BSize(wm) != em) {
fontBaseline =
aMetrics.BlockStartAscent() + (em - finalSize.BSize(wm)) / 2;
aMetrics.SetBlockStartAscent(fontBaseline);
aMetrics.SetBlockStartAscent(aMetrics.BlockStartAscent() +
(em - finalSize.BSize(wm)) / 2);
finalSize.BSize(wm) = em;
}
}
@ -9353,7 +9343,7 @@ void nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
0,
"Negative descent???");
mAscent = fontBaseline;
mAscent = aMetrics.BlockStartAscent();
// Handle text that runs outside its normal bounds.
nsRect boundingBox = RoundOut(textMetrics.mBoundingBox);
@ -10031,10 +10021,6 @@ Maybe<nscoord> nsTextFrame::GetNaturalBaselineBOffset(
}
if (!aWM.IsOrthogonalTo(GetWritingMode())) {
if (aWM.IsCentralBaseline()) {
return Some(GetLogicalUsedBorderAndPadding(aWM).BStart(aWM) +
ContentSize(aWM).BSize(aWM) / 2);
}
return Some(mAscent);
}

Просмотреть файл

@ -21,6 +21,8 @@ const kInheritedDiv = document.getElementById("inherited");
const kResetDiv = document.getElementById("nonInherited");
const kNoAuthorStylesDiv = document.getElementById("noAuthorStyleApplied");
SimpleTest.expectAssertions(3, 3); // bug 1790201
function computedValue(node, property) {
return get_computed_value(getComputedStyle(node), property);
}

Просмотреть файл

@ -3548,25 +3548,20 @@ Maybe<nscoord> nsTableFrame::GetNaturalBaselineBOffset(
OrderRowGroups(orderedRowGroups);
// XXX not sure if this should be the size of the containing block instead.
nsSize containerSize = mRect.Size();
auto TableBaseline = [aWM, containerSize](
nsTableRowGroupFrame* aRowGroup,
nsTableRowFrame* aRow) -> Maybe<nscoord> {
auto TableBaseline = [aWM, containerSize](nsTableRowGroupFrame* aRowGroup,
nsTableRowFrame* aRow) {
nscoord rgBStart =
LogicalRect(aWM, aRowGroup->GetNormalRect(), containerSize).BStart(aWM);
nscoord rowBStart =
LogicalRect(aWM, aRow->GetNormalRect(), aRowGroup->GetSize())
.BStart(aWM);
return aRow->GetRowBaseline(aWM).map(
[rgBStart, rowBStart](nscoord aBaseline) {
return rgBStart + rowBStart + aBaseline;
});
LogicalRect(aWM, aRow->GetNormalRect(), containerSize).BStart(aWM);
return rgBStart + rowBStart + aRow->GetRowBaseline(aWM);
};
if (aBaselineGroup == BaselineSharingGroup::First) {
for (uint32_t rgIndex = 0; rgIndex < orderedRowGroups.Length(); rgIndex++) {
nsTableRowGroupFrame* rgFrame = orderedRowGroups[rgIndex];
nsTableRowFrame* row = rgFrame->GetFirstRow();
if (row) {
return TableBaseline(rgFrame, row);
return Some(TableBaseline(rgFrame, row));
}
}
} else {
@ -3574,9 +3569,7 @@ Maybe<nscoord> nsTableFrame::GetNaturalBaselineBOffset(
nsTableRowGroupFrame* rgFrame = orderedRowGroups[rgIndex];
nsTableRowFrame* row = rgFrame->GetLastRow();
if (row) {
return TableBaseline(rgFrame, row).map([this, aWM](nscoord aBaseline) {
return BSize(aWM) - aBaseline;
});
return Some(BSize(aWM) - TableBaseline(rgFrame, row));
}
}
}

Просмотреть файл

@ -398,15 +398,13 @@ void nsTableRowFrame::DidResize() {
// *including* cells with rowspans
nscoord nsTableRowFrame::GetMaxCellAscent() const { return mMaxCellAscent; }
Maybe<nscoord> nsTableRowFrame::GetRowBaseline(WritingMode aWM) {
nscoord nsTableRowFrame::GetRowBaseline(WritingMode aWM) {
if (mMaxCellAscent) {
return Some(mMaxCellAscent);
return mMaxCellAscent;
}
// If we get here, we don't have a baseline on any of the cells in this row.
if (aWM.IsCentralBaseline()) {
return Nothing{};
}
nscoord ascent = 0;
for (nsIFrame* childFrame : mFrames) {
MOZ_ASSERT(childFrame->IsTableCellFrame());
@ -414,7 +412,7 @@ Maybe<nscoord> nsTableRowFrame::GetRowBaseline(WritingMode aWM) {
childFrame, aWM, BaselineSharingGroup::First);
ascent = std::max(ascent, s);
}
return Some(ascent);
return ascent;
}
nscoord nsTableRowFrame::GetInitialBSize(nscoord aPctBasis) const {

Просмотреть файл

@ -132,7 +132,7 @@ class nsTableRowFrame : public nsContainerFrame {
/* return the row ascent
*/
Maybe<nscoord> GetRowBaseline(mozilla::WritingMode aWM);
nscoord GetRowBaseline(mozilla::WritingMode aWritingMode);
/** returns the ordinal position of this row in its table */
virtual int32_t GetRowIndex() const;

Просмотреть файл

@ -28,12 +28,9 @@ using namespace mozilla::layout;
nscoord nsTableWrapperFrame::SynthesizeFallbackBaseline(
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
const auto marginBlockEnd = GetLogicalUsedMargin(aWM).BEnd(aWM);
if (aWM.IsCentralBaseline()) {
return (BSize(aWM) + marginBlockEnd) / 2;
}
// Our fallback baseline is the block-end margin-edge, with respect to the
// given writing mode.
const auto marginBlockEnd = GetLogicalUsedMargin(aWM).BEnd(aWM);
if (aBaselineGroup == BaselineSharingGroup::Last) {
return -marginBlockEnd;
}

Просмотреть файл

@ -0,0 +1,2 @@
[inline-table-inline-block-baseline-vert-rl.html]
expected: FAIL

Просмотреть файл

@ -5,9 +5,6 @@
[.target > * 3]
expected: FAIL
[.target > * 4]
expected: FAIL
[.target > * 5]
expected: FAIL
@ -17,12 +14,18 @@
[.target > * 9]
expected: FAIL
[.target > * 10]
[.target > * 11]
expected: FAIL
[.target > * 13]
expected: FAIL
[.target > * 15]
expected: FAIL
[.target > * 17]
expected: FAIL
[.target > * 19]
expected: FAIL

Просмотреть файл

@ -14,8 +14,20 @@
[.target > * 9]
expected: FAIL
[.target > * 11]
expected: FAIL
[.target > * 13]
expected: FAIL
[.target > * 15]
expected: FAIL
[.target > * 17]
expected: FAIL
[.target > * 19]
expected: FAIL
[.target > * 21]
expected: FAIL

Просмотреть файл

@ -1,17 +1,19 @@
[baseline-source-last-002.html]
[.target > * 3]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[.target > * 1]
expected: FAIL
[.target > * 4]
[.target > * 3]
expected: FAIL
[.target > * 5]
expected: FAIL
[.target > * 9]
[.target > * 7]
expected: FAIL
[.target > * 10]
[.target > * 9]
expected: FAIL
[.target > * 11]
@ -20,6 +22,9 @@
[.target > * 13]
expected: FAIL
[.target > * 15]
expected: FAIL
[.target > * 17]
expected: FAIL

Просмотреть файл

@ -1,10 +1,16 @@
[baseline-source-last-003.html]
[.target > * 1]
expected: FAIL
[.target > * 3]
expected: FAIL
[.target > * 5]
expected: FAIL
[.target > * 7]
expected: FAIL
[.target > * 9]
expected: FAIL
@ -14,6 +20,9 @@
[.target > * 13]
expected: FAIL
[.target > * 15]
expected: FAIL
[.target > * 17]
expected: FAIL

Просмотреть файл

@ -0,0 +1,3 @@
[inline-block-alignment-002.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-block-alignment-003.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-block-alignment-004.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-block-alignment-005.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-table-alignment-002.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-table-alignment-003.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-table-alignment-004.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952

Просмотреть файл

@ -0,0 +1,3 @@
[inline-table-alignment-005.xht]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1179952