Closed Bug 653739 Opened 14 years ago Closed 11 years ago

Incorrect intrinsic width computed for replaced element with intrinsic ratio and parent-dependent style height when ancestor is a scrollframe

Categories

(Core :: Layout, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 829958

People

(Reporter: bzbarsky, Unassigned)

References

Details

Attachments

(1 file)

Attached file Testcase
See attached testcase. The problem is that as we go up the tree in GetPercentHeight called from nsLayoutUtils::IntrinsicForContainer, we get to the scrolled frame, which is auto height. So we assume the image will have its intrinsic width, and make the containing inline-block too wide.
I would guess that button-content has similar issues, and maybe cell-content...
Ehsan, would your GetContainingBlock changes help here?
(In reply to comment #2) > Ehsan, would your GetContainingBlock changes help here? No, just tested, sorry.
Does that patch change GetPercentHeight in nsLayoutUtils.cpp?
Yes, it does. This is how the containing block for the frame is computed with my patch: nsIFrame *f = aFrame->GetContainingBlock();
More specifically: 8 diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp 9 --- a/layout/base/nsLayoutUtils.cpp 10 +++ b/layout/base/nsLayoutUtils.cpp 11 @@ -2046,20 +2046,17 @@ static PRBool GetAbsoluteCoord(const nsS 12 static PRBool 13 GetPercentHeight(const nsStyleCoord& aStyle, 14 nsIFrame* aFrame, 15 nscoord& aResult) 16 { 17 if (eStyleUnit_Percent != aStyle.GetUnit()) 18 return PR_FALSE; 19 · 20 - nsIFrame *f; 21 - for (f = aFrame->GetParent(); f && !f->IsContainingBlock(); 22 - f = f->GetParent()) 23 - ; 24 + nsIFrame *f = aFrame->GetContainingBlock(); 25 if (!f) { 26 NS_NOTREACHED("top of frame tree not a containing block"); 27 return PR_FALSE; 28 } 29 · 30 const nsStylePosition *pos = f->GetStylePosition(); 31 nscoord h; 32 if (!GetAbsoluteCoord(pos->mHeight, h) &&
Depends on: 10209
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: