Bug 1040668 part 9 - Compute overflow from text-shadow after text decorations. r=dbaron

--HG--
extra : source : 6827c7ef262e47cd42fea6b1a90e09883a7d24dc
This commit is contained in:
Xidorn Quan 2015-11-28 11:56:33 +11:00
parent 376cdf821b
commit 72495f58ae
4 changed files with 56 additions and 4 deletions

View File

@ -5123,10 +5123,6 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
nsRect* aVisualOverflowRect,
bool aIncludeTextDecorations)
{
// Text-shadow overflows
nsRect shadowRect =
nsLayoutUtils::GetTextShadowRectsUnion(*aVisualOverflowRect, this);
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, shadowRect);
bool verticalRun = mTextRun->IsVertical();
bool useVerticalMetrics = verticalRun && mTextRun->UseCenterBaseline();
bool inverted = GetWritingMode().IsLineInverted();
@ -5300,6 +5296,12 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
: nsRect(0, topOrLeft, measure, bottomOrRight - topOrLeft));
}
}
// Text-shadow overflows
nsRect shadowRect =
nsLayoutUtils::GetTextShadowRectsUnion(*aVisualOverflowRect, this);
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, shadowRect);
// When this frame is not selected, the text-decoration area must be in
// frame bounds.
if (!IsSelected() ||

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<style>
.outer {
text-decoration: underline;
position: absolute;
}
.outer+.outer {
color: green;
}
.inner {
vertical-align: 1em;
}
.outer+.outer>.inner {
position: relative;
top: 1em;
}
</style>
</head>
<body>
<span class="outer"><span class="inner">x</span></span>
<span class="outer"><span class="inner">x</span></span>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<style>
.outer { text-decoration: underline; }
.inner {
vertical-align: 1em;
text-shadow: 0 1em green;
}
.reftest-wait .inner {
text-shadow: 0 1em red;
}
</style>
</head>
<body>
<span class="outer"><span class="inner">x</span></span>
<script>
document.addEventListener("MozReftestInvalidate", () => {
document.documentElement.removeAttribute('class');
}, false);
</script>
</body>
</html>

View File

@ -36,3 +36,5 @@ fails-if(Android||B2G) needs-focus == text-shadow-selected-2.html text-shadow-se
# bug 721750
needs-focus == text-shadow-on-selection-1.html text-shadow-on-selection-1-ref.html
needs-focus == text-shadow-on-selection-2.html text-shadow-on-selection-2-ref.html
== overflow-decoration.html overflow-decoration-ref.html