Bizarre GetMinWidth/GetPrefWidth behavior

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bizarre GetMinWidth/GetPrefWidth behavior

Boris Zbarsky
I have a nsSelectsAreaFrame (which is just an nsAreaFrame for reflow purposes)
doing the following:

Area(select)(1)@0x88657d0: GetPrefWidth
   line 0 (inline,empty)
     pref: [prevLines=0 currentLine=0]
   line 1 (block)
     Block(option)(1)@0x86dcc88: GetPrefWidth
       line 0 (inline)
         pref: [prevLines=0 currentLine=168]
     pref: [prevLines=224 currentLine=0]
Area(select)(1)@0x88657d0: GetMinWidth
   line 0 (inline,empty)
     min: [prevLines=0 currentLine=0]
   line 1 (block)
     Block(option)(1)@0x86dcc88: GetMinWidth
       line 0 (inline)
         min: [prevLines=0 currentLine=168]
     min: [prevLines=280 currentLine=0]

Note that the return value of GetMinWidth is larger than that of GetPrefWidth!
This triggers some asserts I added to nsHTMLReflowState.

I tracked this down to the fact that nsIFrame::InlinePrefWidthData::Break
subtracts off trailingWhitespace from currentLine, while
nsIFrame::InlineMinWidthData::Break does not.  Should the latter be subtracting
it off as well?  Or is my assertion that GetPrefWidth() >= GetMinWidth() not
something I can assert?

-Boris
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre GetMinWidth/GetPrefWidth behavior

L. David Baron
On Sunday 2006-06-04 23:30 -0500, Boris Zbarsky wrote:
> I tracked this down to the fact that nsIFrame::InlinePrefWidthData::Break
> subtracts off trailingWhitespace from currentLine, while
> nsIFrame::InlineMinWidthData::Break does not.  Should the latter be
> subtracting it off as well?  Or is my assertion that GetPrefWidth() >=
> GetMinWidth() not something I can assert?

I think the idea was that breakable whitespace would never be added to
InlineMinWidthData in the first place; it doesn't have a
trailingWhitespace member.  Seems not to be what I implemented, though.
(It was a while ago; I don't really remember.)

I'll have a look more closely tomorrow if you haven't already.  Maybe
the best approach is to add the member to make things more symmetric
instead of doing what I originally planned, although maybe the original
plan is easy too.

-David

--
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre GetMinWidth/GetPrefWidth behavior

L. David Baron
On Sunday 2006-06-04 22:27 -0700, L. David Baron wrote:
> I think the idea was that breakable whitespace would never be added to
> InlineMinWidthData in the first place; it doesn't have a
> trailingWhitespace member.  Seems not to be what I implemented, though.
> (It was a while ago; I don't really remember.)

Of course, with 'white-space: nowrap' (which is probably what's used
inside a select), whitespace is trimmable but not breakable.  So I
clearly need it in both places.

-David

--
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre GetMinWidth/GetPrefWidth behavior

Boris Zbarsky
In reply to this post by L. David Baron
L. David Baron wrote:
> Of course, with 'white-space: nowrap' (which is probably what's used
> inside a select)

Yeah, <select> has "white-space: nowrap ! important" set on it.

> whitespace is trimmable but not breakable.  So I
> clearly need it in both places.

I can do that, I think.  I'll let you know if I run into trouble.  ;)

-Boris
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre GetMinWidth/GetPrefWidth behavior

L. David Baron
On Monday 2006-06-05 13:52 -0500, Boris Zbarsky wrote:
> >whitespace is trimmable but not breakable.  So I
> >clearly need it in both places.
>
> I can do that, I think.  I'll let you know if I run into trouble.  ;)

Already done.

-David

--
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout

attachment0 (196 bytes) Download Attachment