Skip to content

Commit 1c6a8b5

Browse files
Cristian Tunsabutkovits@mozilla.com
authored andcommitted
Revert "Bug 1979915 Part 2 - Update text expectations for implementing text-decoration-trim r=layout-jp-market-reviewers,jfkthame,TYLin" for causing Wr failures in text-decoration-trim-007.html
This reverts commit b52edf6. Revert "Bug 1979915 Part 1 - Apply text-decoration-trim during decoration rect calculation and decoration painting. r=layout-reviewers,layout-jp-market-reviewers,jfkthame" This reverts commit 05067d0.
1 parent e8e83d0 commit 1c6a8b5

17 files changed

+32
-101
lines changed

layout/generic/nsTextFrame.cpp

Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -5772,97 +5772,6 @@ static gfxFloat ComputeDecorationLineOffset(
57725772
return 0;
57735773
}
57745774

5775-
// Helper to determine decoration trim offset.
5776-
// Returns false if the trim would cut off the decoration entirely.
5777-
static bool ComputeDecorationTrim(
5778-
const nsTextFrame* aFrame, const nsPresContext* aPresCtx,
5779-
const nsIFrame* aDecFrame, const gfxFont::Metrics& aMetrics,
5780-
nsCSSRendering::DecorationRectParams& aParams) {
5781-
const gfxFloat app = aPresCtx->AppUnitsPerDevPixel();
5782-
const WritingMode wm = aDecFrame->GetWritingMode();
5783-
bool verticalDec = wm.IsVertical();
5784-
5785-
aParams.trimLeft = 0.0;
5786-
aParams.trimRight = 0.0;
5787-
5788-
// Find the trim values for this frame.
5789-
const StyleTextDecorationTrim& cssTrim =
5790-
aDecFrame->StyleTextReset()->mTextDecorationTrim;
5791-
gfxFloat trimLeft, trimRight;
5792-
if (cssTrim.IsAuto()) {
5793-
// Use the EM size divide by 8, or 1 dev pixel if this is too
5794-
// small to ensure that at least some separation occurs.
5795-
const gfxFloat scale = aPresCtx->CSSToDevPixelScale().scale;
5796-
const nscoord autoDecorationTrim =
5797-
std::max(aMetrics.emHeight * 0.125, scale);
5798-
trimLeft = autoDecorationTrim;
5799-
trimRight = autoDecorationTrim;
5800-
} else {
5801-
MOZ_ASSERT(cssTrim.IsLength(), "Impossible text-decoration-trim");
5802-
const auto& length = cssTrim.AsLength();
5803-
if (length.start.IsZero() && length.end.IsZero()) {
5804-
// We can avoid doing the geometric calculations below, potentially
5805-
// walking up and back down the frame tree, and walking continuations.
5806-
return true;
5807-
}
5808-
trimLeft = NSAppUnitsToDoublePixels(length.start.ToAppUnits(), app);
5809-
trimRight = NSAppUnitsToDoublePixels(length.end.ToAppUnits(), app);
5810-
}
5811-
5812-
if (wm.IsBidiRTL()) {
5813-
std::swap(trimLeft, trimRight);
5814-
}
5815-
const nsPoint offset = aFrame->GetOffsetTo(aDecFrame);
5816-
const nsSize decSize = aDecFrame->GetSize();
5817-
const nsSize size = aFrame->GetSize();
5818-
nscoord start, end, max;
5819-
if (verticalDec) {
5820-
start = offset.y;
5821-
max = size.height;
5822-
end = decSize.height - (size.height + offset.y);
5823-
} else {
5824-
start = offset.x;
5825-
max = size.width;
5826-
end = decSize.width - (size.width + offset.x);
5827-
}
5828-
5829-
const bool cloneDecBreak = aDecFrame->StyleBorder()->mBoxDecorationBreak ==
5830-
StyleBoxDecorationBreak::Clone;
5831-
// TODO alaskanemily: This will not correctly account for the case that the
5832-
// continuations are bidi continuations.
5833-
const bool applyLeft = cloneDecBreak || !aDecFrame->GetPrevContinuation();
5834-
if (applyLeft) {
5835-
trimLeft -= NSAppUnitsToDoublePixels(start, app);
5836-
}
5837-
const bool applyRight = cloneDecBreak || !aDecFrame->GetNextContinuation();
5838-
if (applyRight) {
5839-
trimRight -= NSAppUnitsToDoublePixels(end, app);
5840-
}
5841-
5842-
if (trimLeft >= NSAppUnitsToDoublePixels(max, app) - trimRight) {
5843-
// This frame does not contain the decoration at all.
5844-
return false;
5845-
}
5846-
// TODO alaskanemily: We currently determine if we should have a negative
5847-
// trim value by checking if we are at the edge of frame from which the
5848-
// decloration comes from.
5849-
//
5850-
// This is not absolutely correct, there could in theory be a zero-width
5851-
// frame before/after this frame, and we will draw the decoration extension
5852-
// twice (causing a visible inaccuracy for semi-transparent decorations).
5853-
//
5854-
// I am unsure if it's possible that the first/last frame might be inset
5855-
// for some reason, as well, in which case we will not draw the outset
5856-
// decorations.
5857-
if (applyLeft && (trimLeft > 0.0 || start == 0)) {
5858-
aParams.trimLeft = trimLeft;
5859-
}
5860-
if (applyRight && (trimRight > 0.0 || end == 0)) {
5861-
aParams.trimRight = trimRight;
5862-
}
5863-
return true;
5864-
}
5865-
58665775
void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
58675776
nsIFrame* aBlock,
58685777
PropertyProvider& aProvider,
@@ -6004,11 +5913,6 @@ void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
60045913
metrics, appUnitsPerDevUnit, this, parentWM.IsCentralBaseline(),
60055914
swapUnderline);
60065915

6007-
if (!ComputeDecorationTrim(this, aPresContext, dec.mFrame, metrics,
6008-
params)) {
6009-
return;
6010-
}
6011-
60125916
nsRect decorationRect =
60135917
nsCSSRendering::GetTextDecorationRect(aPresContext, params) +
60145918
(verticalDec ? nsPoint(frameBStart - dec.mBaselineOffset, 0)
@@ -7765,10 +7669,7 @@ void nsTextFrame::DrawTextRunAndDecorations(
77657669
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
77667670
const Metrics metrics = GetFirstFontMetrics(
77677671
GetFontGroupForFrame(dec.mFrame, inflation), useVerticalMetrics);
7768-
if (!ComputeDecorationTrim(this, aParams.textStyle->PresContext(),
7769-
dec.mFrame, metrics, params)) {
7770-
return;
7771-
}
7672+
77727673
bCoord = (frameBStart - dec.mBaselineOffset) / app;
77737674

77747675
params.color = dec.mColor;

layout/painting/nsCSSRendering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ struct nsCSSRendering {
554554
mozilla::Side aStartBevelSide, nscoord aStartBevelOffset,
555555
mozilla::Side aEndBevelSide, nscoord aEndBevelOffset);
556556

557-
// NOTE: pt, dirtyRect, lineSize, ascent, offset, trimLeft, and trimRight in
557+
// NOTE: pt, dirtyRect, lineSize, ascent, offset, trimStart and trimEnd in
558558
// the following structs are non-rounded device pixels, not app units.
559559
struct DecorationRectParams {
560560
// Checks if either start or end trim value is negative.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-001.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-002.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-003.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-004.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-005.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-006.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-007.html]
2+
expected: FAIL
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[text-decoration-trim-008.html]
2+
expected: FAIL

0 commit comments

Comments
 (0)