Bug 886716 - Fix sorting of text-overflow:ellipsis relative to positioned content. r=mats
authorCameron McCormack <cam@mcc.id.au>
Fri, 18 Jan 2019 04:50:02 +0000
changeset 454654 176554242eb31ffb066e48c84004eba1824293d5
parent 454653 a8e0501505f47a64d8b26ab0be981a32cddd89ae
child 454655 af184e29a54633ac5b8dc0a7726dd556676c243e
push id35409
push userrmaries@mozilla.com
push dateMon, 21 Jan 2019 17:48:45 +0000
treeherdermozilla-central@4977d02e1191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs886716
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 886716 - Fix sorting of text-overflow:ellipsis relative to positioned content. r=mats Differential Revision: https://phabricator.services.mozilla.com/D15504
layout/generic/nsBlockFrame.cpp
testing/web-platform/tests/css/css-ui/reference/text-overflow-030-ref.html
testing/web-platform/tests/css/css-ui/text-overflow-030.html
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6510,24 +6510,24 @@ void nsBlockFrame::BuildDisplayList(nsDi
       lineCount++;
     }
 
     if (nonDecreasingYs && lineCount >= MIN_LINES_NEEDING_CURSOR) {
       SetupLineCursor();
     }
   }
 
-  // Pick up the resulting text-overflow markers.  We append them to
-  // PositionedDescendants just before we append the lines' display items,
-  // so that our text-overflow markers will appear on top of this block's
-  // normal content but below any of its its' positioned children.
+  linesDisplayListCollection.MoveTo(aLists);
+
   if (textOverflow.isSome()) {
-    aLists.PositionedDescendants()->AppendToTop(&textOverflow->GetMarkers());
-  }
-  linesDisplayListCollection.MoveTo(aLists);
+    // Put any text-overflow:ellipsis markers on top of the non-positioned
+    // content of the block's lines. (If we ever start sorting the Content()
+    // list this will end up in the wrong place.)
+    aLists.Content()->AppendToTop(&textOverflow->GetMarkers());
+  }
 
   if (HasOutsideBullet()) {
     // Display outside bullets manually
     nsIFrame* bullet = GetOutsideBullet();
     BuildDisplayListForChild(aBuilder, bullet, aLists);
   }
 
 #ifdef DEBUG
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-ui/reference/text-overflow-030-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+.positioned {
+  background-color: green;
+  position: absolute;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<p>Test passes if there is a green rectangle and no red.</p>
+<div class="positioned"></div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-ui/text-overflow-030.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Basic User Interface Test: ellipsis should render under other positioned content</title>
+<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
+<link rel="help" href="http://www.w3.org/TR/css3-ui/#text-overflow">
+<link rel="match" href="reference/text-overflow-030-ref.html">
+<style>
+.positioned {
+  background-color: green;
+  position: absolute;
+  width: 100px;
+  height: 100px;
+}
+.ellipsis {
+  color: red;
+  overflow-x: hidden;
+  text-overflow: ellipsis;
+  white-space: pre;
+  width: 100px;
+  font: 50px sans-serif;
+}
+</style>
+<p>Test passes if there is a green rectangle and no red.</p>
+<div class="positioned"></div>
+<div class="ellipsis">         </div>