Open Bug 514763 Opened 15 years ago Updated 2 years ago

Implement "cropped" attribute for XUL labels

Categories

(Core :: XUL, enhancement)

enhancement

Tracking

()

People

(Reporter: Gabri, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 6 obsolete files)

I think we should implement an attribute (e.g.: cropped) which allows us to determine if the value of a label was cropped or not.
Blocks: 445000
Attached patch Trivial patch (obsolete) — Splinter Review
Attachment #398825 - Flags: review?(enndeakin)
Attachment #398825 - Flags: review?(enndeakin)
Attached patch Patch (obsolete) — Splinter Review
"cropped" attribute have to be assigned to the main element if the label is an anonymous node.
Attachment #398825 - Attachment is obsolete: true
Attachment #398865 - Flags: review?(enndeakin)
Comment on attachment 398865 [details] [diff] [review] Patch Unfortunately, attributes can't be changed during painting or layout directly, because mutation listeners could be called which could delete the elements and frames, which could cause a crash. This would either need to pass false for the last argument(that may cause other problems though) or be done asynchronously. There are a number of other places in the code that does the latter, such as menus, if we wanted to go that route.
Attachment #398865 - Flags: review?(enndeakin) → review-
Attached patch I hope now it's ok (obsolete) — Splinter Review
Thanks to Smaug who helped me to make this patch. I hope that now it works properly :)
Attachment #398865 - Attachment is obsolete: true
Attachment #399069 - Flags: review?(enndeakin)
Attached patch Ops, now it's ok :) (obsolete) — Splinter Review
Attachment #399069 - Attachment is obsolete: true
Attachment #399070 - Flags: review?(enndeakin)
Attachment #399069 - Flags: review?(enndeakin)
Attachment #399070 - Attachment is patch: true
Attachment #399070 - Attachment mime type: application/octet-stream → text/plain
Tommoeeow I'll make some tests
Err, tomorrow
Attached patch Patch + reftests (obsolete) — Splinter Review
I added a reftest
Attachment #399070 - Attachment is obsolete: true
Attachment #399451 - Flags: review?(enndeakin)
Attachment #399070 - Flags: review?(enndeakin)
Attached patch Patch with a better reftest (obsolete) — Splinter Review
Attachment #399451 - Attachment is obsolete: true
Attachment #399457 - Flags: review?(enndeakin)
Attachment #399451 - Flags: review?(enndeakin)
Comment on attachment 399457 [details] [diff] [review] Patch with a better reftest >+ nsIContent* croppedElement = mContent; >+ if (mContent->GetBindingParent()) >+ croppedElement = mContent->GetBindingParent(); What is this part for? To set cropped on buttons? This will also end up setting cropped on a parent bindings when a label is used in any binding. What would happen in a case like the following: label { max-width: 20px; } label[cropped=true] { max-width: 500px; } where having the cropped attribute causes the size to grow such that it no longer needs the cropping, thus reseting the width to 20px, and repeat.
Attachment #399457 - Flags: review?(enndeakin)
One month ago I spoke with Smaug about that and he told me that we could use an asyncronous function to resolve this problem. I'll post a new patch soon, maybe... :)
Depends on: tooltips
Attached file testcase v1
If you open this testcase you should not see nothing without the patch. If you include the patch on your firefox source you should see e green label. Now, with the problem reported by neil, you'll see a blinking label.
OS: Windows XP → All
Hardware: x86 → All
Version: unspecified → Trunk
Attached patch Patch, v2.0Splinter Review
(In reply to comment #11) > (From update of attachment 399457 [details] [diff] [review]) > >+ nsIContent* croppedElement = mContent; > >+ if (mContent->GetBindingParent()) > >+ croppedElement = mContent->GetBindingParent(); > > What is this part for? To set cropped on buttons? This will also end up setting > cropped on a parent bindings when a label is used in any binding. We could check the tag of the bindingParent. Have you an idea about that? > What would happen in a case like the following: > > label { max-width: 20px; } > label[cropped=true] { max-width: 500px; } > > where having the cropped attribute causes the size to grow such that it no > longer needs the cropping, thus reseting the width to 20px, and repeat. I fixed that in this new patch adding a control that checks if the label cropped for more than 3 times per seconds, if yes it doesn't set the attribute for the label.
Attachment #399457 - Attachment is obsolete: true
Attachment #413903 - Flags: review?
Attachment #413903 - Flags: review? → review?(enndeakin)
Component: DOM → XUL
QA Contact: general → xptoolkit.widgets
Assignee: nobody → gabri.best
Blocks: tooltips
No longer depends on: tooltips
No longer blocks: tooltips
Comment on attachment 413903 [details] [diff] [review] Patch, v2.0 This needs to be updated, although I'm not sure about this idea.
Attachment #413903 - Flags: review?(enndeakin) → review-

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: gabri.best → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: