Open
Bug 514763
Opened 15 years ago
Updated 2 years ago
Implement "cropped" attribute for XUL labels
Categories
(Core :: XUL, enhancement)
Core
XUL
Tracking
()
NEW
People
(Reporter: Gabri, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 6 obsolete files)
477 bytes,
application/vnd.mozilla.xul+xml
|
Details | |
12.53 KB,
patch
|
enndeakin
:
review-
|
Details | Diff | Splinter Review |
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.
Reporter | ||
Comment 1•15 years ago
|
||
Reporter | ||
Updated•15 years ago
|
Attachment #398825 -
Flags: review?(enndeakin)
Reporter | ||
Updated•15 years ago
|
Attachment #398825 -
Flags: review?(enndeakin)
Reporter | ||
Comment 2•15 years ago
|
||
"cropped" attribute have to be assigned to the main element if the label is an anonymous node.
Attachment #398825 -
Attachment is obsolete: true
Reporter | ||
Updated•15 years ago
|
Attachment #398865 -
Flags: review?(enndeakin)
Comment 3•15 years ago
|
||
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-
Comment 4•15 years ago
|
||
FYI, there are helpers classes for safe set/unset attr.
http://mxr.mozilla.org/mozilla-central/source/layout/base/nsLayoutUtils.h#1107
Reporter | ||
Comment 5•15 years ago
|
||
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)
Reporter | ||
Comment 6•15 years ago
|
||
Attachment #399069 -
Attachment is obsolete: true
Attachment #399070 -
Flags: review?(enndeakin)
Attachment #399069 -
Flags: review?(enndeakin)
Reporter | ||
Updated•15 years ago
|
Attachment #399070 -
Attachment is patch: true
Attachment #399070 -
Attachment mime type: application/octet-stream → text/plain
Reporter | ||
Comment 7•15 years ago
|
||
Tommoeeow I'll make some tests
Reporter | ||
Comment 8•15 years ago
|
||
Err, tomorrow
Reporter | ||
Comment 9•15 years ago
|
||
I added a reftest
Attachment #399070 -
Attachment is obsolete: true
Attachment #399451 -
Flags: review?(enndeakin)
Attachment #399070 -
Flags: review?(enndeakin)
Reporter | ||
Comment 10•15 years ago
|
||
Attachment #399451 -
Attachment is obsolete: true
Attachment #399457 -
Flags: review?(enndeakin)
Attachment #399451 -
Flags: review?(enndeakin)
Comment 11•15 years ago
|
||
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.
Reporter | ||
Updated•15 years ago
|
Attachment #399457 -
Flags: review?(enndeakin)
Reporter | ||
Comment 12•15 years ago
|
||
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... :)
Reporter | ||
Comment 13•15 years ago
|
||
Reporter | ||
Comment 14•15 years ago
|
||
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.
Reporter | ||
Updated•15 years ago
|
OS: Windows XP → All
Hardware: x86 → All
Version: unspecified → Trunk
Reporter | ||
Comment 15•15 years ago
|
||
(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?
Reporter | ||
Updated•15 years ago
|
Attachment #413903 -
Flags: review? → review?(enndeakin)
Updated•15 years ago
|
Component: DOM → XUL
QA Contact: general → xptoolkit.widgets
Updated•15 years ago
|
Comment 16•11 years ago
|
||
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-
Comment 17•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.
Assignee: gabri.best → nobody
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•