Closed Bug 843322 Opened 7 years ago Closed 7 years ago

text-overflow: ellipsis does not work on placeholders

Categories

(Core :: Layout: Form Controls, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: davidwalsh, Assigned: mats)

References

Details

Attachments

(1 file, 1 obsolete file)

Placeholder-generated content on INPUT elements should allow for "text-overflow: ellipsis" via "input[placeholder]" or "::-moz-placeholder"

This works within WebKit (I promise I'm not trolling by saying that) and I think it would be a nice touch for Firefox as well.
Blocks: 821867
Mounir, do we actually get overflow out of the placeholder?  If so, I'd expect this to Just Work....
Component: DOM: CSS Object Model → Layout: Form Controls
The overflow areas looks correct to me (essential parts from a frame dump):

HTMLScroll(div) {300,180,10620,900} [state=0000000000004000] pst=:-moz-placeholder<
  Block(div) {0,0,10620,900} [scr-overflow=0,0,17700,900] pst=:-moz-scrolled-content<
    line 0x7fffd4ed9ab0:  {60,0,17640,900} <
      Text(0)"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" pst=:-moz-non-element
    >
  >

so this *should* work.
Assignee: nobody → matspal
Severity: normal → minor
OS: Mac OS X → All
Hardware: x86 → All
Here's an example of it working in WebKit but not Firefox:

http://davidwalsh.name/demo/ell.php

If you check out the source, I'm trying any number of ways to make this work.
Attached patch fix (obsolete) — Splinter Review
There were two problems,
1. one has to explicitly declare that a property applies to placeholders
2. IsHorizontalOverflowVisible must stop a the nearest scroll frame, even if
   it's a pseudo (see frame tree in comment 2)

FWIW, I tested the new vs. old IsHorizontalOverflowVisible asserting that
there were no difference for layout/reftests/text-overflow/reftest.list
(before adding the new tests)

https://tbpl.mozilla.org/?tree=Try&rev=c07d6c790915
Attachment #716894 - Flags: review?(roc)
Note that Mounir proposed a spec for which properties should apply to placeholders; that may need updating.
(In reply to David Walsh :davidwalsh from comment #3)
> http://davidwalsh.name/demo/ell.php

Yes, that works with the patch.

> I'm trying any number of ways to make this work.

I don't think there are any workarounds, sorry.
Sure Matt, I simply felt bad for not providing an example and wanted to show I did everything I could to prove that I was doing wrong.  Thank you all!
Attached patch fix+test, v2Splinter Review
Tweaked the new reftest a little, hopefully it'll pass this time:

https://tbpl.mozilla.org/?tree=Try&rev=1a76ecacf86d
Attachment #716894 - Attachment is obsolete: true
Attachment #716894 - Flags: review?(roc)
Attachment #716932 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/ffb9e097d950
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.