mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
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:
parent
0d7e3acda0
commit
5ac6d26487
@ -6131,10 +6131,15 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
|
|||||||
!lineMayHaveTextOverflow)
|
!lineMayHaveTextOverflow)
|
||||||
return;
|
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 ...
|
// Block-level child backgrounds go on the blockBorderBackgrounds list ...
|
||||||
// Inline-level child backgrounds go on the regular child content list.
|
// Inline-level child backgrounds go on the regular child content list.
|
||||||
nsDisplayListSet childLists(aLists,
|
nsDisplayListSet childLists(collection,
|
||||||
lineInline ? aLists.Content() : aLists.BlockBorderBackgrounds());
|
lineInline ? collection.Content() : collection.BlockBorderBackgrounds());
|
||||||
|
|
||||||
uint32_t flags = lineInline ? nsIFrame::DISPLAY_CHILD_INLINE : 0;
|
uint32_t flags = lineInline ? nsIFrame::DISPLAY_CHILD_INLINE : 0;
|
||||||
|
|
||||||
@ -6147,8 +6152,10 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lineMayHaveTextOverflow) {
|
if (lineMayHaveTextOverflow) {
|
||||||
aTextOverflow->ProcessLine(aLists, aLine.get());
|
aTextOverflow->ProcessLine(collection, aLine.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collection.MoveTo(aLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
28
layout/reftests/text-overflow/line-clipping-ref.html
Normal file
28
layout/reftests/text-overflow/line-clipping-ref.html
Normal 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…</div>
|
||||||
|
<div class="test">well, hell… world</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
32
layout/reftests/text-overflow/line-clipping.html
Normal file
32
layout/reftests/text-overflow/line-clipping.html
Normal 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>
|
@ -1,4 +1,5 @@
|
|||||||
skip-if(B2G) == ellipsis-font-fallback.html ellipsis-font-fallback-ref.html
|
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-basic.html marker-basic-ref.html
|
||||||
skip-if(B2G) HTTP(..) == marker-string.html marker-string-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
|
skip-if(Android||B2G) HTTP(..) == bidi-simple.html bidi-simple-ref.html # Fails on Android due to anti-aliasing
|
||||||
|
Loading…
Reference in New Issue
Block a user