Bug 886313: Make DisplayLine generate display items in a temporary collection, so we can apply text-overflow clipping without affecting earlier lines. r=roc

This commit is contained in:
Daniel Holbert 2013-06-28 00:22:57 -07:00
parent 0d7e3acda0
commit 5ac6d26487
4 changed files with 71 additions and 3 deletions

View File

@ -6131,10 +6131,15 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
!lineMayHaveTextOverflow)
return;
// Collect our line's display items in a temporary nsDisplayListCollection,
// so that we can apply any "text-overflow" clipping to the entire collection
// without affecting previous lines.
nsDisplayListCollection collection;
// Block-level child backgrounds go on the blockBorderBackgrounds list ...
// Inline-level child backgrounds go on the regular child content list.
nsDisplayListSet childLists(aLists,
lineInline ? aLists.Content() : aLists.BlockBorderBackgrounds());
nsDisplayListSet childLists(collection,
lineInline ? collection.Content() : collection.BlockBorderBackgrounds());
uint32_t flags = lineInline ? nsIFrame::DISPLAY_CHILD_INLINE : 0;
@ -6147,8 +6152,10 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
}
if (lineMayHaveTextOverflow) {
aTextOverflow->ProcessLine(aLists, aLine.get());
aTextOverflow->ProcessLine(collection, aLine.get());
}
collection.MoveTo(aLists);
}
void

View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<html>
<head>
<title>Reference for bug 886313</title>
<style type="text/css">
@font-face {
font-family: DejaVuSansMono;
src: url(../fonts/DejaVuSansMono.woff),url(DejaVuSansMono.woff);
}
.test {
font: 16px DejaVuSansMono;
overflow: hidden;
width:55px;
border: 1px solid black;
margin-bottom: 2px;
}
</style>
</head>
<body>
<div class="test">well, hello world</div>
<div class="test">well, hello worl&#x2026;</div>
<div class="test">well, hell&#x2026; world</div>
</body>
</html>

View File

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
Test: When we have multiple lines of text with "text-overflow: ellipsis",
an ellipsis on one line shouldn't affect the other lines.
-->
<html>
<head>
<title>Testcase for bug 886313</title>
<style type="text/css">
@font-face {
font-family: DejaVuSansMono;
src: url(../fonts/DejaVuSansMono.woff),url(DejaVuSansMono.woff);
}
.test {
font: 16px DejaVuSansMono;
text-overflow:ellipsis;
overflow: hidden;
width:55px;
border: 1px solid black;
margin-bottom: 2px;
}
</style>
</head>
<body>
<div class="test">well, hello world</div>
<div class="test">well, hello world!</div>
<div class="test">well, helloo world</div>
</body>
</html>

View File

@ -1,4 +1,5 @@
skip-if(B2G) == ellipsis-font-fallback.html ellipsis-font-fallback-ref.html
== line-clipping.html line-clipping-ref.html
skip-if(B2G) HTTP(..) == marker-basic.html marker-basic-ref.html
skip-if(B2G) HTTP(..) == marker-string.html marker-string-ref.html
skip-if(Android||B2G) HTTP(..) == bidi-simple.html bidi-simple-ref.html # Fails on Android due to anti-aliasing