Closed Bug 263050 Opened 20 years ago Closed 20 years ago

auto sized iframe and object frames report bogus MEW

Categories

(Core :: Layout: Tables, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mozillabugzilla, Assigned: bernd_mozilla)

References

()

Details

(Keywords: testcase)

Attachments

(4 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040624 Debian/1.7-2
Build Identifier: among others, Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040624 Debian/1.7-2 and Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040928 Firefox/0.9.3

The iframe in the left cell overlaps the text in the right cell.

The same problem comes up with objects, see mozbug2.html.

Reproducible: Always
Steps to Reproduce:
1. Go to website :)

Actual Results:  
I saw the iframe overlap the text in the other cell

Expected Results:  
showing the iframe in one cell, and the text in the other, without overlap.
Attached file testcase
its always better to attach the testcase to bugzilla than to host it on a some
foreign server, the server goes probably much faster away than the bug
Attached file object testcase
 cell 0254AAE8 r=0 a=UC,UC c=UC,UC cnt=869
  block 0254AB94 r=0 a=UC,UC c=UC,UC cnt=870
   subdoc 0254ADD4 r=0 a=UC,UC c=UC,UC cnt=871
   subdoc 0254ADD4 d=3648,1848 me=48
  block 0254AB94 d=3648,1848 me=48
 cell 0254AAE8 d=3672,1872 me=72

cell 0254AAE8 r=2 a=744,UC c=720,UC cnt=880
 block 0254AB94 r=2 a=720,UC c=720,UC cnt=881
  subdoc 0254ADD4 r=2 a=720,UC c=UC,UC cnt=882
  subdoc 0254ADD4 d=3648,1848 me=48
 block 0254AB94 d=720,1848 me=48 o=(0,0) 3648 x 1848
cell 0254AAE8 d=744,1872 me=72

if a frame reports a mew of 48 it should be possible to shrink the frame to any
size that is greater than the MEW.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Table cell with object or iframe overlaps with other cell → auto sized iframe and object frames report bogus MEW
374   if (aDesiredSize.mComputeMEW) {
375     // If our width is set by style to some fixed length,
376     // then our actual width is our minimum width
377     nsStyleUnit widthUnit = GetStylePosition()->mWidth.GetUnit();
378     if (widthUnit != eStyleUnit_Percent && widthUnit != eStyleUnit_Auto) {
379       aDesiredSize.mMaxElementWidth = aDesiredSize.width;
380     } else {
381       // if our width is auto or a percentage, then we can shrink until
382       // there's nothing left but our borders
383       aDesiredSize.mMaxElementWidth = border.left + border.right;
384     }
385   }

is not in sync with 
 if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedWidth) {
303     aDesiredSize.width = aReflowState.mComputedWidth;
304   }
305   else {
306     aDesiredSize.width = PR_MIN(PR_MAX(NSIntPixelsToTwips(300, p2t),
307                                        aReflowState.mComputedMinWidth),
308                                 aReflowState.mComputedMaxWidth);
309   }

we dont shrink below 300px for an autowidth iframe
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → bernd_mozilla
Status: NEW → ASSIGNED
the patch fixes both testcases
Attachment #161195 - Flags: superreview?(roc)
Attachment #161195 - Flags: review?(roc)
Are there any related good bits for a solution for bug 227470 in this fix?
Comment on attachment 161195 [details] [diff] [review]
patch

switching reviewer (Robert is busy)
Attachment #161195 - Flags: superreview?(roc)
Attachment #161195 - Flags: superreview?(dbaron)
Attachment #161195 - Flags: review?(roc)
Attachment #161195 - Flags: review?(dbaron)
Keywords: testcase
Comment on attachment 161195 [details] [diff] [review]
patch

>+        if (!mContent->IsContentOfType(nsIContent::eXUL))

Was there supposed to be something after this?	Setting p2t only if we're not
XUL seems highly unusual.


Also, the general structure here is

if (!a && !b) {
} else {
  if (a) {
  } else {
  }
}

That's a bit odd, since they're all testing the same condition.  It would be
clearer as either:

if (is auto) {
} else if (is percent) {
} else {
}

or 

switch (widthUnit) {
  case auto:
    break;
  case percent:
    break;
  default:
}

Also, watch the spacing -- there's an "if(" with no space.

Also, do you want to account for mComputedMaxWidth as well, like the other code
you quoted does?
Attachment #161195 - Flags: superreview?(dbaron)
Attachment #161195 - Flags: superreview-
Attachment #161195 - Flags: review?(dbaron)
Attachment #161195 - Flags: review-
Attached patch revised patchSplinter Review
Attachment #161195 - Attachment is obsolete: true
Comment on attachment 162375 [details] [diff] [review]
revised patch

I am not certain how the correct indent should look like in the
eStyleUnit_Auto: case, but I hope thats a minor issue.
Attachment #162375 - Flags: superreview?(dbaron)
Attachment #162375 - Flags: review?(dbaron)
Comment on attachment 162375 [details] [diff] [review]
revised patch

>+    case eStyleUnit_Auto:
>+      aDesiredSize.mMaxElementWidth = PR_MIN(PR_MAX(defaultAutoWidth,
>+                                             aReflowState.mComputedMinWidth),
>+                                             aReflowState.mComputedMaxWidth) +
>+                                      border.left + border.right;
>+      break;

min-width should override max-width, so you need to reverse the PR_MIN and
PR_MAX.  Also, indent the second line more., so it should look like

PR_MAX(PR_MIN(defaultAutoWidth,
	       aReflowState.mComputedMaxWidth),
       aReflowState.mComputedMinWidth) +
border.left +border.right;
Attachment #162375 - Flags: superreview?(dbaron)
Attachment #162375 - Flags: superreview+
Attachment #162375 - Flags: review?(dbaron)
Attachment #162375 - Flags: review+
Attached patch revised patchSplinter Review
Comment on attachment 167928 [details] [diff] [review]
revised patch

David could you please rereview, the code that you critized is not my
invention, I think the code should by in sync.
Attachment #167928 - Flags: superreview?(dbaron)
Attachment #167928 - Flags: review?(dbaron)
Comment on attachment 167928 [details] [diff] [review]
revised patch

r+sr=dbaron.  It's probably worth filing a separate bug on implementing
min/max-width/height on iframes that don't have auto width/height.
Attachment #167928 - Flags: superreview?(dbaron)
Attachment #167928 - Flags: superreview+
Attachment #167928 - Flags: review?(dbaron)
Attachment #167928 - Flags: review+
shouldn't that be done inside the ReflowState?
Yeah, it seems to work already, so never mind.
fix checked in
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: