Closed
Bug 380736
Opened 18 years ago
Closed 18 years ago
Inline image attachment resizing (zoom / hourglass) is always enabled, even when useless
Categories
(SeaMonkey :: MailNews: Message Display, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: sgautherie, Assigned: csthomas)
References
Details
Attachments
(3 files, 3 obsolete files)
10.31 KB,
patch
|
neil
:
superreview+
|
Details | Diff | Splinter Review |
11.39 KB,
patch
|
mscott
:
review+
mscott
:
superreview+
|
Details | Diff | Splinter Review |
16.48 KB,
patch
|
Details | Diff | Splinter Review |
Inline image attachment resizing (zoom / hourglass) is always enabled, even when useless:
the mouse pointer changes from '+' <-> '-', while the image rests unchanged.
This is confusing.
Regressed between
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a3pre) Gecko/20070320 SeaMonkey/1.5a] (2007-03-20-08-trunk) (W2Ksp4)
and
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a3pre) Gecko/20070321 SeaMonkey/1.5a] (2007-03-21-08-trunk) (W2Ksp4)
<http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=MozillaTinderboxAll&branch=HEAD&branchtype=match&sortby=Date&hours=2&date=explicit&mindate=2007-03-20+08&maxdate=2007-03-21+09&cvsroot=%2Fcvsroot>
Likely culprit: [Bug 372080 – allow image attachments that are displayed inline to be scaled].
Read bug 372080 comment 23...
Assignee | ||
Updated•18 years ago
|
Assignee: mail → cst
Assignee | ||
Comment 2•18 years ago
|
||
Still need to:
1) scale the image on message load, if it doesn't fit. getElementsByTagName, check for the class name?
2) when you resize the window/splitters, I need to check if each image is overflowing or not.
Attachment #265884 -
Flags: review?(neil)
Assignee | ||
Comment 3•18 years ago
|
||
This seems to work. I didn't test messageWindow, just the pane in messenger.
Attachment #265884 -
Attachment is obsolete: true
Attachment #269553 -
Flags: superreview?(neil)
Attachment #269553 -
Flags: review?(bienvenu)
Attachment #265884 -
Flags: review?(neil)
Assignee | ||
Comment 4•18 years ago
|
||
(I can do a tbird patch once the fix is OK'd for SeaMonkey)
Comment 5•18 years ago
|
||
Comment on attachment 269553 [details] [diff] [review]
patch
Thx for doing this, Chris. It looks OK to me, but it's more up to Neil. For TB, I wouldn't want the K&R braces style, especially at the function () level.
Attachment #269553 -
Flags: review?(bienvenu) → review+
Comment 6•18 years ago
|
||
Comment on attachment 269553 [details] [diff] [review]
patch
Note: while I was reading this, I thought of a possible alternative: don't change the existing code, but on load and resize simply set an attribute on those images that are overflowing that you key off for the CSS i.e.
.moz-attached-image-unscaled[overflowing="true"] {
cursor: -moz-zoom-out;
}
.moz-attached-image-scaled[overflowing="true"] {
cursor: -moz-zoom-in;
max-width: 100%;
}
>+ var imgs = doc.getElementsByTagName("img");
document.images
>+ if (img.naturalWidth > doc.width) {
Would you mind reversing this test so you can do if else if else if?
>+ if (/^moz-attached-image/.test(target.className)) {
>+ var shouldFit = target.hasAttribute("shrinktofit");
>+ var isShrunk = target.hasAttribute("isshrunk");
>+ var overflowing = target.naturalWidth > target.ownerDocument.width;
>+ if (overflowing && shouldFit) {
>+ if (isShrunk) {
>+ // currently shrunk to fit, so unshrink it
>+ target.removeAttribute("isshrunk");
>+ target.removeAttribute("shrinktofit");
>+ target.style.cursor = "-moz-zoom-out";
>+ target.style.maxWidth = "";
>+ }
>+ else {
>+ // currently full size, so shrink it
>+ target.setAttribute("isshrunk", "yes");
>+ target.setAttribute("shrinktofit", "yes");
>+ target.style.cursor = "-moz-zoom-in";
>+ target.style.maxWidth = "100%";
>+ }
>+ }
>+ else if (overflowing && !shouldFit) {
>+ // user wants to shrink now
>+ target.setAttribute("isshrunk", "yes");
>+ target.setAttribute("shrinktofit", "yes");
>+ target.style.cursor = "-moz-zoom-in";
>+ target.style.maxWidth = "100%";
>+ }
>+ }
I think this is overly complicated. The ImageDocument code works like this:
If the image is shrunk, then unshrink it, and turn off automatic resizing.
Otherwise, turn on automatic resizing, and shrink it to fit if overflowing.
Attachment #269553 -
Flags: superreview?(neil) → superreview-
Assignee | ||
Comment 7•18 years ago
|
||
Maybe this is better.
Attachment #269553 -
Attachment is obsolete: true
Attachment #273247 -
Flags: superreview?(neil)
Comment 8•18 years ago
|
||
Comment on attachment 273247 [details] [diff] [review]
patch v2
>+ img.setAttribute("overflowing", "yes");
Actually I think we tend to use "true" values for things like this.
>+ var shouldFit = target.hasAttribute("shrinktofit");
You don't seem to use this.
>+ var isShrunk = target.hasAttribute("isshrunk");
>+ var doesntFit = target.naturalWidth > target.ownerDocument.width;
You only use these once, you might as well inline them. Also, can't you use target.hasAttribute("overflowing") here?
>+ if (isShrunk) {
>+ // currently shrunk to fit, so unshrink it
>+ target.removeAttribute("isshrunk");
>+ target.removeAttribute("shrinktofit");
>+ target.setAttribute("overflowing", "yes");
>+ }
>+ else if (doesntFit) {
>+ // user wants to shrink now
>+ target.setAttribute("isshrunk", "yes");
>+ target.setAttribute("shrinktofit", "yes");
>+ target.removeAttribute("overflowing");
>+ }
This doesn't match with what onresize does - it doesn't clear overflowing on images shrunk to fit; you probably remove both overflowing lines here.
Assignee | ||
Comment 9•18 years ago
|
||
Ok, I made "isshrunk" mutually exclusive with "overflowing" (to avoid dependencies on the ordering within the CSS files).
Attachment #274103 -
Flags: superreview?(neil)
Assignee | ||
Updated•18 years ago
|
Attachment #273247 -
Attachment is obsolete: true
Attachment #273247 -
Flags: superreview?(neil)
Updated•18 years ago
|
Attachment #274103 -
Flags: superreview?(neil) → superreview+
Assignee | ||
Comment 10•18 years ago
|
||
Comment on attachment 274103 [details] [diff] [review]
v3 (checked in)
Checked in for SeaMonkey. I'm pretty sure I just broke the feature in Thunderbird... so I guess I have to fix that too before resolving this.
Attachment #274103 -
Attachment description: v3 → v3 (checked in)
Assignee | ||
Comment 11•18 years ago
|
||
Attachment #275370 -
Flags: review?(mscott)
Comment 12•18 years ago
|
||
Comment on attachment 275370 [details] [diff] [review]
patch for tbird
thanks Chris!
Attachment #275370 -
Flags: superreview+
Attachment #275370 -
Flags: review?(mscott)
Attachment #275370 -
Flags: review+
Comment 13•18 years ago
|
||
Comment on attachment 275370 [details] [diff] [review]
patch for tbird
+ function messagePaneOnResize(event) {
When in Rome ...
Assignee | ||
Comment 14•18 years ago
|
||
Checked in tbird version; fixed newline-before-brace for both mailnews and tbird.
Assignee | ||
Updated•18 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•