RESOLVED FIXED Bug 71254
Amend missing uses of LayoutUnit in RenderBlock
https://bugs.webkit.org/show_bug.cgi?id=71254
Summary Amend missing uses of LayoutUnit in RenderBlock
Levi Weintraub
Reported 2011-10-31 17:00:26 PDT
There are still numerous places in RenderBlock we're using ints where we should be using LayoutUnits. Correcting.
Attachments
Patch (29.72 KB, patch)
2011-10-31 17:31 PDT, Levi Weintraub
no flags
Patch (24.88 KB, patch)
2011-11-01 17:01 PDT, Levi Weintraub
no flags
Patch for landing (24.88 KB, patch)
2011-11-01 17:29 PDT, Levi Weintraub
no flags
Levi Weintraub
Comment 1 2011-10-31 17:31:13 PDT
Eric Seidel (no email)
Comment 2 2011-10-31 17:37:20 PDT
Comment on attachment 113114 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113114&action=review > Source/WebCore/rendering/RenderBlock.cpp:115 > + m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : LayoutUnit(0); Explicit wrapping of zero makes me sad-faced. :(
Emil A Eklund
Comment 3 2011-11-01 15:39:40 PDT
(In reply to comment #2) > (From update of attachment 113114 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=113114&action=review > > > Source/WebCore/rendering/RenderBlock.cpp:115 > > + m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : LayoutUnit(0); > > Explicit wrapping of zero makes me sad-faced. :( Sadly it's needed for the ternary operator. Would a constant (something like LAYOUT_ZERO) be less ugly?
Levi Weintraub
Comment 4 2011-11-01 15:52:55 PDT
(In reply to comment #2) > (From update of attachment 113114 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=113114&action=review > > > Source/WebCore/rendering/RenderBlock.cpp:115 > > + m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : LayoutUnit(0); > > Explicit wrapping of zero makes me sad-faced. :( We can also save these for our final patch, where we can just use LayoutUnit() if you prefer
Eric Seidel (no email)
Comment 5 2011-11-01 16:01:43 PDT
LayoutUnit::zero would probably read better to my eyes, even though that's more characters. :(
Levi Weintraub
Comment 6 2011-11-01 16:05:05 PDT
(In reply to comment #5) > LayoutUnit::zero would probably read better to my eyes, even though that's more characters. :( We can't do that with our typedef, unfortunately, but we can once we've switched from ints. In the meantime, I think I'll just remove the wrapping and leave it for our branch integration.
Eric Seidel (no email)
Comment 7 2011-11-01 16:10:20 PDT
I mean, it's trivial to convert from a typedef to a class if you feel that's holding you back. :) But OK.
Levi Weintraub
Comment 8 2011-11-01 16:12:43 PDT
(In reply to comment #7) > I mean, it's trivial to convert from a typedef to a class if you feel that's holding you back. :) But OK. I'd much rather postpone this than switch to a class to represent the int base type :p
Levi Weintraub
Comment 9 2011-11-01 17:01:19 PDT
Darin Adler
Comment 10 2011-11-01 17:26:05 PDT
Comment on attachment 113259 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113259&action=review Is numeric_limits<LayoutUnit>::max() ever actually the right/helpful value for LayoutUnit other than int? > Source/WebCore/rendering/RenderBlock.cpp:2503 > + // We don't want to had off painting in the line box tree with the accumulated error of the render tree, as this will cause "had off"?
Levi Weintraub
Comment 11 2011-11-01 17:27:09 PDT
Comment on attachment 113259 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113259&action=review >> Source/WebCore/rendering/RenderBlock.cpp:2503 >> + // We don't want to had off painting in the line box tree with the accumulated error of the render tree, as this will cause > > "had off"? "hand off", thanks for the catch and the review!
Levi Weintraub
Comment 12 2011-11-01 17:29:29 PDT
Created attachment 113263 [details] Patch for landing
WebKit Review Bot
Comment 13 2011-11-01 18:33:31 PDT
Comment on attachment 113263 [details] Patch for landing Clearing flags on attachment: 113263 Committed r99024: <http://trac.webkit.org/changeset/99024>
WebKit Review Bot
Comment 14 2011-11-01 18:33:36 PDT
All reviewed patches have been landed. Closing bug.
Levi Weintraub
Comment 15 2011-11-01 23:09:43 PDT
(In reply to comment #10) > (From update of attachment 113259 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=113259&action=review > > Is numeric_limits<LayoutUnit>::max() ever actually the right/helpful value for LayoutUnit other than int? I missed your first comment about numeric_limits<LayoutUnit>. If you look at the subpixellayout branch or the patch on bug 71143, you'll see I actually implemented the numeric_limits struct for AppUnit, which is what we're aiming to replace ints with.
Darin Adler
Comment 16 2011-11-02 10:28:03 PDT
(In reply to comment #15) > (In reply to comment #10) > > Is numeric_limits<LayoutUnit>::max() ever actually the right/helpful value for LayoutUnit other than int? > > I missed your first comment about numeric_limits<LayoutUnit>. If you look at the subpixellayout branch or the patch on bug 71143, you'll see I actually implemented the numeric_limits struct for AppUnit, which is what we're aiming to replace ints with. I don’t think the standard allows specializing numeric_limits for non-built-in types, but it might work with most compilers we deal with now. There are other solutions that don’t require non-standard code.
Note You need to log in before you can comment on or make changes to this bug.