Bug 843322 - Make CSS 'text-overflow' apply to ::-moz-placeholder. r=roc
authorMats Palmgren <matspal@gmail.com>
Sat, 23 Feb 2013 11:38:15 +0100
changeset 122756 ffb9e097d95067b468dd7dd2e50e6d8beef9d034
parent 122755 006c88b32c8fe03b6508743ceb5fbe2a59dc8cf2
child 122757 f5cc4349f6d79a1c2fbf028362b166d0522dbdd0
push id23469
push usermpalmgren@mozilla.com
push dateSat, 23 Feb 2013 10:38:20 +0000
treeherdermozilla-inbound@ffb9e097d950 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs843322
milestone22.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 843322 - Make CSS 'text-overflow' apply to ::-moz-placeholder. r=roc
layout/generic/TextOverflow.cpp
layout/reftests/text-overflow/anonymous-block-ref.html
layout/reftests/text-overflow/anonymous-block.html
layout/style/nsCSSPropList.h
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -78,17 +78,18 @@ IsFullyClipped(nsTextFrame* aFrame, nsco
 
 static bool
 IsHorizontalOverflowVisible(nsIFrame* aFrame)
 {
   NS_PRECONDITION(nsLayoutUtils::GetAsBlock(aFrame) != nullptr,
                   "expected a block frame");
 
   nsIFrame* f = aFrame;
-  while (f && f->StyleContext()->GetPseudo()) {
+  while (f && f->StyleContext()->GetPseudo() &&
+         f->GetType() != nsGkAtoms::scrollFrame) {
     f = f->GetParent();
   }
   return !f || f->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE;
 }
 
 static nsDisplayItem*
 ClipMarker(nsDisplayListBuilder* aBuilder,
            nsIFrame*             aFrame,
--- a/layout/reftests/text-overflow/anonymous-block-ref.html
+++ b/layout/reftests/text-overflow/anonymous-block-ref.html
@@ -39,21 +39,28 @@ span {
   left:16em;
 }
 
 .t1 {width:6em;}
 .t2 {width:2em;}
 .t3 {width:25em;}
 .t4 {width:17.5em;}
 
+input { font-family:DejaVuSansMono; width:3em; }
+
 </style>
 
 </head><body>
 
 
 <div class="test t1"><x>Some ove<m>&#x2026;</m><span><i style="display:block;">anonymous<br>block</i>and</span> unin<m>&#x2026;</m></x></div>
 <div class="test t2"><x>So<m>&#x2026;</m><i style="display:block;">anonymous<br>block</i>an<m>&#x2026;</m></x></div>
 <div style="position:absolute;"><div class="test t3" style="border-style:none;padding:1px"><x>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<m style="padding-left:16em">&#x2026;</m></div></div>
 <div class="test t3"><x>Some overly <span>l&nbsp;&nbsp;&nbsp;</span><span><i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 <div class="test t4"><x>Some overly <m>&#x2026;</m><span>long<i style="display:block;">anonymous<br>block</i>a&nbsp;&nbsp;</span> uninformative sentence</x></div>
 
+<input placeholder="pla&#x2026;">
+<input dir="rtl" placeholder="der&#x2026;">
+<input placeholder="plaX">
+<input dir="rtl" placeholder="Xder">
+
 </body>
 </html>
--- a/layout/reftests/text-overflow/anonymous-block.html
+++ b/layout/reftests/text-overflow/anonymous-block.html
@@ -42,20 +42,34 @@ span {
   left:16em;
 }
 
 .t1 {width:6em;}
 .t2 {width:2em;}
 .t3 {width:25em;}
 .t4 {width:17.5em;}
 
+input { font-family:DejaVuSansMono; width:3em; }
+input::-moz-placeholder {
+  overflow:hidden;
+  text-overflow:ellipsis;
+}
+input.t5::-moz-placeholder {
+  text-overflow:"X";
+}
+
 </style>
 
 </head><body>
 
 
 <div class="test t1"><x>Some overly <span>long<i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 <div class="test t2"><x>Some overly long<i style="display:block;">anonymous<br>block</i>and uninformative sentence</x></div>
 <div class="test t3"><x>Some overly <span>long<i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 <div class="test t4"><x>Some overly <span>long<i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 
+<input placeholder="placeholder">
+<input dir="rtl" placeholder="placeholder">
+<input class="t5" placeholder="placeholder">
+<input class="t5" dir="rtl" placeholder="placeholder">
+
 </body>
 </html>
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -2670,17 +2670,18 @@ CSS_PROP_TEXT(
     nullptr,
     offsetof(nsStyleText, mTextIndent),
     eStyleAnimType_Coord)
 CSS_PROP_TEXTRESET(
     text-overflow,
     text_overflow,
     TextOverflow,
     CSS_PROPERTY_PARSE_VALUE |
-        CSS_PROPERTY_VALUE_PARSER_FUNCTION,
+        CSS_PROPERTY_VALUE_PARSER_FUNCTION |
+        CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
     "",
     0,
     kTextOverflowKTable,
     offsetof(nsStyleTextReset, mTextOverflow),
     eStyleAnimType_None)
 CSS_PROP_TEXT(
     text-shadow,
     text_shadow,