[Webkit-unassigned] [Bug 206317] Clamp paddingBoxWidth/Height to a minimum of zero

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 28 19:27:38 PST 2020


https://bugs.webkit.org/show_bug.cgi?id=206317

--- Comment #10 from zalan <zalan at apple.com> ---
(In reply to Darin Adler from comment #9)
> Comment on attachment 388594 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=388594&action=review
> 
> > Source/WebCore/rendering/RenderBox.h:221
> > +    LayoutUnit paddingBoxWidth() const { return std::max<LayoutUnit>(0, width() - borderLeft() - borderRight() - verticalScrollbarWidth()); }
> > +    LayoutUnit paddingBoxHeight() const { return std::max<LayoutUnit>(0, height() - borderTop() - borderBottom() - horizontalScrollbarHeight()); }
> 
> A more economical way to write this is "std::max(0_lu,"
> 
> >> Source/WebCore/rendering/RenderReplaced.cpp:461
> >> +    logicalWidth = std::max(0_lu, (logicalWidth - (marginStart + marginEnd + borderLeft() + borderRight() + verticalScrollbarWidth())));
> > 
> > I am confused how this works (or even worked before). The logical width here (which is the content logical width) of an inline replaced box is supposed to be the containing block's content box width - (margin start + border inline start + padding inline start + padding inline end + border inline end + margin end), since the constraint equation is as follows containing block's content width = margin s + border s + padding s + content width + padding e + border e + margin e.
> > It's even in the comment a few lines above.
> 
> I am going to say review+ here, but I am concerned that Alan is confused
> about this, since this is an area he's expert on. Please follow up with him.

(In reply to zalan from comment #8)
> Comment on attachment 388594 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=388594&action=review
> 
> > Source/WebCore/rendering/RenderReplaced.cpp:461
> > -    logicalWidth = std::max(0_lu, (logicalWidth - (marginStart + marginEnd + (size().width() - clientWidth()))));
> > +    logicalWidth = std::max(0_lu, (logicalWidth - (marginStart + marginEnd + borderLeft() + borderRight() + verticalScrollbarWidth())));
> 
> I am confused how this works (or even worked before). The logical width here
> (which is the content logical width) of an inline replaced box is supposed
> to be the containing block's content box width - (margin start + border
> inline start + padding inline start + padding inline end + border inline end
> + margin end), since the constraint equation is as follows containing
> block's content width = margin s + border s + padding s + content width +
> padding e + border e + margin e.
> It's even in the comment a few lines above.
I guess this is fine since you are not changing behavior here. I am just baffled how incorrect this is (as per https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width) and specifically that there's even a comment above this line disagreeing with the logic here. I would put a fixme or some kind of explanation why it is ok to have it this way.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200129/8185a270/attachment.htm>


More information about the webkit-unassigned mailing list