Images with percent (%) width/height nested inside an inline element should scale relative to containing block

RESOLVED FIXED in mozilla1.7alpha

Status

()

Core
Layout: Block and Inline
P1
major
RESOLVED FIXED
16 years ago
3 years ago

People

(Reporter: Will Small, Assigned: dbaron)

Tracking

({testcase})

Trunk
mozilla1.7alpha
testcase
Points:
---
Dependency tree / graph
Bug Flags:
blocking1.6 -

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [reflow-refactor][patch], URL)

Attachments

(3 attachments, 2 obsolete attachments)

(Reporter)

Description

16 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.3) Gecko/20010801
BuildID:    2001080110

Row of buttons along top of page is displayed incorrectly.  They are
variable-sized eg. 10% of windth, 14% of width.  Mozilla handles this incorrectly.


Reproducible: Always
Steps to Reproduce:
1.visit http://linkx.spinrx.com/cgi-bin/advancesailing/index.html
2. Compare with other browsers
3. Email me if you don't see what I'm talking about

Actual Results:  The images are scrunched in mozilla.

Expected Results:  Images should not be scrunched.

Comment 1

16 years ago
Confirming, simplified test case to follow.

This only happens if the images are inside links.  It looks like, in that
instance, the percentage width being used for each subsequent image is being
calculated as a fraction of the remaining page width, rather than total page width.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Toolbar at 2" down across top should stretch across the page as it does in IE or NS but gets scrunched to the left instead → Images with %sizes inside links not scaling properly

Comment 2

16 years ago
Created attachment 47877 [details]
testcase, html file

Comment 3

16 years ago
Created attachment 47879 [details]
testcase, gif image to go with html - save as b1.gif
is this still happening in recent builds?

Comment 5

16 years ago
Comment on attachment 47879 [details]
testcase, gif image to go with html - save as b1.gif

Yes, I'm still seeing it in 2001091508 win32
Attachment #47879 - Attachment description: testcase, gif image to go with html → testcase, gif image to go with html - save as b1.gif

Comment 6

16 years ago
Apologies for the spam, should have checked this before adding the last comment.
  Still present in 2001092403, win98SE, also.
*** Bug 101926 has been marked as a duplicate of this bug. ***
Please see http://www.usahistory.com/noframe.htm for another testcase from my
duped bug 101926.  The screenshot there is attachment 51055 [details].  This is 4xp and
occurs on Linux as well.


------- Additional Comments From Christopher Hoess 2001-09-27 08:33 -------

The HTML 4.01 spec says of percentage image widths "Note that lengths expressed 
as percentages are based on the horizontal or vertical space currently 
available," a rather ambiguous definition.  However, CSS width (which applies to 
replaced elements) says that percentages are calculated in terms of the 
containing block.  Since HTML width="" is supposed to be replaced by the CSS 
equivalent, the change (fix?) proposed here makes sense...
Keywords: 4xp
OS: Windows 98 → All
Summary: Images with %sizes inside links not scaling properly → Images with %sizes inside links should scale relative to containing block
*** Bug 115544 has been marked as a duplicate of this bug. ***
to attinasi -- this is not table-specific
Assignee: karnaze → attinasi
*** Bug 119581 has been marked as a duplicate of this bug. ***
Nominating; it should be an easy fix.

Bug 119581 also has a testcase w/ no table.
Keywords: mozilla0.9.8

Updated

16 years ago
Target Milestone: --- → mozilla1.0.1

Comment 13

16 years ago
Moving Mozilla 1.01 bugs to 'future' milestone with priority P1

I will be pulling bugs from 'future' milestones when scheduling later work.
Priority: -- → P1
Target Milestone: mozilla1.0.1 → Future

Updated

16 years ago
Keywords: mozilla0.9.8 → mozilla1.0

Comment 14

15 years ago
It does not have to be within links. Try www.leifjensen.com. This works always
(almost always, might need a reload) in NS 4.77/4.78. I can't make it load the
picture at all in any Mozilla 0.9.x/1.0x nor NS6.x.

Comment 15

15 years ago
Konqueror 2.2.2 loads it nicely.
mozilla1.0 -> mozilla1.01

There's a testcase with no tables in my dup of this.  We're definitely laying
this out incorrectly.
Keywords: mozilla1.0 → mozilla1.0.1

Comment 17

15 years ago
I was hoping this bug was fixed in Mozilla 1.0rc2, but it's still there.

Comment 18

15 years ago
I noticed a comment that this was only within links. I'm not exactly sure about
that phrase, but I have it also with: <img src=..... width=80% height=80%>. (Try
www.leifjensen.com!)
Created attachment 87711 [details] [diff] [review]
Patch v1.0

Okay, this patch "works" but I'm thinking it is a little late in the game to
fix it here (though I may be wrong).

So I've debugged this last night and it appears that when we create our
nsHTMLReflowState for an image frame, we're already passing in the wrong
computed width of the containing block.  The correct fix IMO would be probably
in nsLineLayout::ReflowFrame() around here:
http://lxr.mozilla.org/mozilla/source/layout/html/base/src/nsLineLayout.cpp?rev=3.135#979
or possibly before we get that far.  When we get the containing block's width
there, it keeps shrinking every time.  That's about as far as I got last night.
 I'll try investigating more later on.
(Assignee)

Comment 20

15 years ago
The real problem is what buster introduced in revision 3.81 of nsLineLayout.cpp.
 We need to figure out what he was really trying to fix.
(Assignee)

Comment 21

15 years ago
I suspect it was for bug 38396 / bug 39901.
(Assignee)

Comment 22

15 years ago
So bug 38396 is really a bug about one of the fundamental flaws in the layout
engine -- that we try to do min-size and pref-size calculations using the same
Reflow method that does layout.  It looks like buster fixed it first by breaking
percentage widths on images, and then by implementing them incorrectly.  Not
that that really helped (see bug 115688 / bug 107873).
(Assignee)

Comment 23

15 years ago
Comment on attachment 87711 [details] [diff] [review]
Patch v1.0

This is going to break stuff like absolutely positioned elements, or anything
that really *needs* to pass in the computed height/width rather than letting
them be calculated (or is nsLineLayout::ReflowFrame  the only caller of that
constructor?!).
Attachment #87711 - Flags: needs-work+

Comment 24

15 years ago
*** Bug 159666 has been marked as a duplicate of this bug. ***
attinasi->dbaron, since he produced a patch
Nominating for 1.3
milestone -> ---
Assignee: attinasi → dbaron
Keywords: mozilla1.0.1 → mozilla1.3
Hardware: PC → All
Target Milestone: Future → ---
(Assignee)

Comment 26

15 years ago
I didn't produce a patch.  I marked a patch as "needs work".
Severity: normal → major
Whiteboard: [reflow-refactoring]
Oops, misread.  Feel free to reassign.  Attinasi seemed a bad choice...

Updated

14 years ago
Summary: Images with %sizes inside links should scale relative to containing block → Images with % width/height nested inside an inline element should scale relative to containing block
->block & inline
Assignee: dbaron → block-and-inline
Component: Layout → Layout: Block & Inline
QA Contact: petersen → ian
(Assignee)

Comment 29

14 years ago
I think I want this, actually.
Assignee: block-and-inline → dbaron
Whiteboard: [reflow-refactoring] → [reflow-refactor]
*** Bug 110358 has been marked as a duplicate of this bug. ***
Summary: Images with % width/height nested inside an inline element should scale relative to containing block → Images with percent (%) width/height nested inside an inline element should scale relative to containing block

Comment 31

14 years ago
Reassigning as dupe seems fine, but comments
are not being copied across, is this a bugzilla bug?

anyway here are my comments copied across:

is work on this proceeding??

I was hoping to roll out a site using % and was just wondering...

http://www.peepo.com/w3/svg-jpg/svg-jpg.html
looks damn silly your way.

thanks
Keywords: mozilla1.3

Updated

14 years ago
Blocks: 194804
(Assignee)

Comment 32

14 years ago
*** Bug 209065 has been marked as a duplicate of this bug. ***

Comment 33

14 years ago
It turns out that the IMG or IFRAME doesn't need to be inside an anchor to cause
the bug.  It also happens if it's simply inside a <span>...</span>
Yes, the bug summary already notes that the image needs to be within an inline.

Comment 35

14 years ago
Congratulations !!  Mozilla 1.4 works with my homepage placing a relative
picture as it should.
(Assignee)

Updated

14 years ago
Blocks: 217817
*** Bug 221398 has been marked as a duplicate of this bug. ***

Updated

14 years ago
Keywords: testcase
(Assignee)

Comment 37

14 years ago
Created attachment 135953 [details] [diff] [review]
patch

I think this is the right fix, and it doesn't regress bug 38396.
(Assignee)

Updated

14 years ago
Attachment #87711 - Attachment is obsolete: true
(Assignee)

Updated

14 years ago
Status: NEW → ASSIGNED
Whiteboard: [reflow-refactor] → [reflow-refactor][patch]
Target Milestone: --- → mozilla1.7alpha
(Assignee)

Updated

14 years ago
Attachment #135953 - Flags: superreview?(roc)
Attachment #135953 - Flags: review?(roc)
Comment on attachment 135953 [details] [diff] [review]
patch

sure
Attachment #135953 - Flags: superreview?(roc)
Attachment #135953 - Flags: superreview+
Attachment #135953 - Flags: review?(roc)
Attachment #135953 - Flags: review+
Is there a reason we no longer need to pass "reason" the the new reflow state?
(Assignee)

Comment 40

14 years ago
Oh, right, I added |reason| back.
(Assignee)

Comment 41

14 years ago
Created attachment 135974 [details] [diff] [review]
patch
Attachment #135953 - Attachment is obsolete: true
Blocks: 226954

Comment 42

14 years ago
could somebody check this in, if it works?
It will get checked in when the tree opens for 1.7alpha.  Patience, young
grasshopper.
(Assignee)

Comment 44

14 years ago
Fix checked in to trunk, 2003-12-18 21:41 -0800.
Status: ASSIGNED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED

Comment 45

14 years ago
working fine, BuildID 2003121823
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7a) Gecko/20031218

checked with http://www.peepo.com/w3/svg-jpg/svg-jpg.html failed yesterday, ok now

Is it too risky to fix this in the branch?
Flags: blocking1.6?
(Assignee)

Comment 46

14 years ago
perhaps I should have put this on the branch a few weeks ago, but I'd rather not
at this point.  We've shipped many releases with this and one more won't hurt
too much.  It will be fixed in 1.7.
Flags: blocking1.6? → blocking1.6-

Comment 47

14 years ago
anyone figure out if this fix cause the regression in
http://bugzilla.mozilla.org/show_bug.cgi?id=230332 ?
It probably did, but our current rendering looks correct (and the old rendering
rather broken)...

Comment 49

13 years ago
Could someone who was involved with this bug please take a look at bug 239778
and let us know if the fix for this bug caused the regression in that one?

It began at the same time this one was fixed, and I can't find a better
candidate for the cause.

thanks!
You need to log in before you can comment on or make changes to this bug.