Closed
Bug 585069
Opened 14 years ago
Closed 13 years ago
xul images should support ratio scaling
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
mozilla8
Tracking | Status | |
---|---|---|
firefox8 | + | --- |
People
(Reporter: enndeakin, Assigned: enndeakin)
References
Details
(Keywords: dev-doc-complete, Whiteboard: [qa-])
Attachments
(1 file, 2 obsolete files)
23.75 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
Such that: <image src="image.png" maxwidth="400" maxheight="300"/> can specify maximum sizes and the image will shrink down with the same ratio in both directions.
Assignee | ||
Comment 1•14 years ago
|
||
Assignee: nobody → enndeakin
Attachment #463557 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #517458 -
Flags: review?
Assignee | ||
Updated•14 years ago
|
Attachment #517458 -
Flags: review? → review?(dbaron)
Updated•13 years ago
|
Blocks: Instantbird
Comment on attachment 517458 [details] [diff] [review] patch with reftests Sorry for taking so long to get to this (though for a while I was postponing it because your bugzilla name said you were on vacation). 'width' and 'height' should not be inputs to nsLayoutUtils::ComputeAutoSizeWithIntrinsicDimensions; they should just be local variables inside of it. (Or, alternatively, they could be out params and the function could return void, but it's probably better returning nsSize as you have it.) In nsLayoutUtils.h, ComputeAutoSizeWithIntrinsicDimensions should give a better explanation of tentWidth and tentHeight: it should describe them as the result of applying the rules for handling intrinsic sizes and ratios. The way you use this in nsImageBoxFrame seems to me to all be off by border+padding. In particular, the code in nsLayoutUtils that you're using intends to deal with content-box sizes, but you're giving it border-box sizes for the min and max sizes (and for the ignored first two parameters), though you're giving it content box sizes for the important last 2 parameters. I *think* that's going to yield the wrong results. Then the code in nsLayoutUtils returns a content box size, but you're returning it directly from GetPrefSize which is supposed to return a border-box size. The hand-written code in nsImageBoxFrame seems likewise incorrect in the presence of border and/or padding. I didn't look closely at your tests, but I think you need a bunch with border and padding; you don't seem to have any.
Attachment #517458 -
Flags: review?(dbaron) → review-
Assignee | ||
Comment 3•13 years ago
|
||
This patch subtracts off and adds on the border/padding as needed.
Attachment #517458 -
Attachment is obsolete: true
Attachment #537208 -
Flags: review?(dbaron)
Comment on attachment 537208 [details] [diff] [review] patch with proper border/padding handling I recommend also having tests with asymmetric padding and border, e.g., with padding: 1px 2px 4px 8px. + if (size.width != NS_INTRINSICSIZE) + size.width += borderPadding.LeftRight(); + if (size.height != NS_INTRINSICSIZE) + size.height += borderPadding.TopBottom(); It shouldn't be possible for these to be NS_INTRINSICSIZE, unless I'm missing something (which I think would also mean things are pretty broken). + nscoord height = size.height; + if (height != NS_INTRINSICSIZE) + height -= borderPadding.TopBottom(); Same here. + nscoord width = size.width; + if (width != NS_INTRINSICSIZE) + width -= borderPadding.LeftRight(); And here. Instead of these tests, could you assert that |size| doesn't have NS_INTRINSICSIZE components both after AddCSSPrefSize and after ComputeAutoSizeWithIntrinsicDimensions? r=dbaron with that Sorry for the delay getting to this.
Attachment #537208 -
Flags: review?(dbaron) → review+
Comment 5•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/7fece42cb99a
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Target Milestone: --- → mozilla8
Assignee | ||
Updated•13 years ago
|
Flags: in-testsuite+
Updated•13 years ago
|
Keywords: dev-doc-needed
Updated•13 years ago
|
tracking-firefox8:
--- → +
Comment 6•13 years ago
|
||
(tracking-8+ since we might need to back this out on aurora if bug 677091 and related issues don't get fixed)
This patch added tests to the reftest directory layout/xul/base/reftest/ (originally added in bug 442228) which was not listed in the toplevel manifest, so they were never run in our automated testing. I just did that: https://hg.mozilla.org/integration/mozilla-inbound/rev/139eed687d77
Comment 8•13 years ago
|
||
Do we know yet whether this will make Firefox 7? I see there's some concern about possibly backing it out.
Assignee | ||
Comment 9•13 years ago
|
||
The regression problems were fixed so it should be staying in.
Assignee | ||
Comment 11•13 years ago
|
||
This bug changes the following behaviour. Given an example such as: <image src="image.png" maxwidth="200"/> where image.png is a large image such as a photo, the old behaviour was to shrink the width down to the maximum allowed of 200 but keep the height the same. The new behaviour aligns more with the html img tag and shrinks both the width and height down proportionally. An automated test also verifies the behaviour.
Comment 12•13 years ago
|
||
Given this is covered by automation, I don't think there is much QA can do to verify this is fixed. Simona, if you feel like you have time, you can code an example like in comment 11 (test it in a previous build and the current build to compare).
Whiteboard: [qa?] → [qa-]
Comment 13•13 years ago
|
||
https://developer.mozilla.org/en/Firefox_8_for_developers#XUL https://developer.mozilla.org/en/XUL/image
Keywords: dev-doc-needed → dev-doc-complete
Comment 14•6 years ago
|
||
Moving to Core:XUL per https://bugzilla.mozilla.org/show_bug.cgi?id=1455336
Component: XP Toolkit/Widgets: XUL → XUL
You need to log in
before you can comment on or make changes to this bug.
Description
•