RESOLVED FIXED Bug 133040
Migrate layout ascents and descents to LayoutUnits instead of ints
https://bugs.webkit.org/show_bug.cgi?id=133040
Summary Migrate layout ascents and descents to LayoutUnits instead of ints
Myles C. Maxfield
Reported 2014-05-17 19:48:28 PDT
Migrate layout ascents and descents to LayoutUnit instead of ints
Attachments
Patch (32.05 KB, patch)
2014-05-17 20:17 PDT, Myles C. Maxfield
no flags
Patch (11.23 KB, patch)
2021-04-03 01:47 PDT, Rob Buis
no flags
Patch (11.31 KB, patch)
2021-04-05 12:40 PDT, Rob Buis
no flags
Patch (11.37 KB, patch)
2021-04-06 00:37 PDT, Rob Buis
no flags
Patch (8.64 KB, patch)
2021-04-06 08:27 PDT, Rob Buis
no flags
Patch (8.67 KB, patch)
2021-07-29 07:32 PDT, Rob Buis
no flags
Patch (8.71 KB, patch)
2021-07-29 09:50 PDT, Rob Buis
no flags
Patch (11.49 KB, patch)
2021-07-31 07:04 PDT, Rob Buis
no flags
Patch (11.66 KB, patch)
2021-07-31 09:55 PDT, Rob Buis
no flags
Patch (11.60 KB, patch)
2021-08-01 02:27 PDT, Rob Buis
no flags
Myles C. Maxfield
Comment 1 2014-05-17 20:17:29 PDT
zalan
Comment 2 2014-05-17 21:53:15 PDT
Comment on attachment 231645 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=231645&action=review > Source/WebCore/rendering/InlineFlowBox.cpp:872 > + LayoutUnit strokeOverflow = static_cast<int>(ceilf(lineStyle.textStrokeWidth() / 2.0f)); missing FIXME here. In general, I transition to LayoutUntits from int/float when I change the functionality as well. int type is a straightforward indication that a particular function/class has not been converted yet to subpixel. Functions with integral LayoutUnits tricked me a few times.
Myles C. Maxfield
Comment 3 2014-06-03 22:08:03 PDT
Rob Buis
Comment 4 2021-04-03 01:47:59 PDT
Rob Buis
Comment 5 2021-04-05 12:40:32 PDT
zalan
Comment 6 2021-04-05 12:53:44 PDT
Comment on attachment 425188 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425188&action=review > Source/WebCore/rendering/RootInlineBox.cpp:819 > + LayoutUnit usedFontAscent = fontMetrics.ascent(baselineType()); It's up to you but as I mentioned in the previous patch I'd prefer uniform initialization (and mention in the changelog that ascent/descent values are still integral).
Rob Buis
Comment 7 2021-04-06 00:37:22 PDT
EWS
Comment 8 2021-04-06 03:49:38 PDT
Committed r275502: <https://commits.webkit.org/r275502> All reviewed patches have been landed. Closing bug and clearing flags on attachment 425252 [details].
Radar WebKit Bug Importer
Comment 9 2021-04-06 03:50:15 PDT
Rob Buis
Comment 10 2021-04-06 07:41:37 PDT
Comment on attachment 425188 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425188&action=review >> Source/WebCore/rendering/RootInlineBox.cpp:819 >> + LayoutUnit usedFontAscent = fontMetrics.ascent(baselineType()); > > It's up to you but as I mentioned in the previous patch I'd prefer uniform initialization (and mention in the changelog that ascent/descent values are still integral). Sure, done.
zalan
Comment 11 2021-04-06 07:53:44 PDT
(In reply to Rob Buis from comment #10) > Comment on attachment 425188 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=425188&action=review > > >> Source/WebCore/rendering/RootInlineBox.cpp:819 > >> + LayoutUnit usedFontAscent = fontMetrics.ascent(baselineType()); > > > > It's up to you but as I mentioned in the previous patch I'd prefer uniform initialization (and mention in the changelog that ascent/descent values are still integral). > > Sure, done. Thanks!
Rob Buis
Comment 12 2021-04-06 08:27:18 PDT
Reopening to attach new patch.
Rob Buis
Comment 13 2021-04-06 08:27:21 PDT
Darin Adler
Comment 14 2021-07-26 14:11:19 PDT
Comment on attachment 425281 [details] Patch What about 0_lu vs. LayoutUnit() ?
Rob Buis
Comment 15 2021-07-29 07:32:43 PDT
Rob Buis
Comment 16 2021-07-29 09:50:57 PDT
Darin Adler
Comment 17 2021-07-29 10:36:46 PDT
Comment on attachment 434530 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434530&action=review > Source/WebCore/ChangeLog:8 > + Migrate GlyphOverflow to LayoutUnits instead of ints. This is missing rationale. Why are we doing this if it has no detectable effect? Does it make some future change possible? Does it make something more efficient? Does it make code more elegant? If it does have a good effect, then why no tests? > Source/WebCore/rendering/LegacyInlineFlowBox.cpp:936 > + LayoutUnit topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom : glyphOverflow->top) : 0_lu; Is it critical to use LayoutUnit rather than auto in these places? I ask because "staying as a LayoutUnit" is one kind of thing. Converting to LayoutUnit is another. Maybe this is conversion to LayoutUnit?
Said Abou-Hallawa
Comment 18 2021-07-29 11:08:39 PDT
Comment on attachment 434530 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434530&action=review > Source/WebCore/style/InlineTextBoxStyle.cpp:100 > -static inline void extendIntToFloat(int& extendMe, float extendTo) > +static inline void extendIntToFloat(LayoutUnit& extendMe, float extendTo) This name does not make sense now. We are extending 'LayoutUnit' not 'int'. But I think this function should be written as two methods of GlyphOverflow since it is only called for the 'top' and 'bottom' members of GlyphOverflow. struct GlyphOverflow { void extendTop(float extendTo) { top = ... } void extendBottom(float extendTo) { bottom = ... } }; And instead of calling: extendIntToFloat(overflowResult.top, -underlineOffset); We can say: overflowResult.extendTop(-underlineOffset);
Myles C. Maxfield
Comment 19 2021-07-29 11:37:30 PDT
Very exciting!!!
Rob Buis
Comment 20 2021-07-31 07:04:04 PDT
Rob Buis
Comment 21 2021-07-31 09:18:13 PDT
Comment on attachment 434530 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434530&action=review >> Source/WebCore/style/InlineTextBoxStyle.cpp:100 >> +static inline void extendIntToFloat(LayoutUnit& extendMe, float extendTo) > > This name does not make sense now. We are extending 'LayoutUnit' not 'int'. > > But I think this function should be written as two methods of GlyphOverflow since it is only called for the 'top' and 'bottom' members of GlyphOverflow. > > struct GlyphOverflow { > void extendTop(float extendTo) > { > top = ... > } > > void extendBottom(float extendTo) > { > bottom = ... > } > }; > > And instead of calling: > extendIntToFloat(overflowResult.top, -underlineOffset); > > We can say: > overflowResult.extendTop(-underlineOffset); I like it! Done.
Rob Buis
Comment 22 2021-07-31 09:55:02 PDT
Rob Buis
Comment 23 2021-08-01 02:27:06 PDT
Rob Buis
Comment 24 2021-08-01 13:45:52 PDT
Comment on attachment 434530 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434530&action=review >> Source/WebCore/ChangeLog:8 >> + Migrate GlyphOverflow to LayoutUnits instead of ints. > > This is missing rationale. > > Why are we doing this if it has no detectable effect? Does it make some future change possible? Does it make something more efficient? Does it make code more elegant? If it does have a good effect, then why no tests? I added a bit to the changelog. >> Source/WebCore/rendering/LegacyInlineFlowBox.cpp:936 >> + LayoutUnit topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom : glyphOverflow->top) : 0_lu; > > Is it critical to use LayoutUnit rather than auto in these places? I ask because "staying as a LayoutUnit" is one kind of thing. Converting to LayoutUnit is another. Maybe this is conversion to LayoutUnit? I think auto is fine indeed since most of these are not conversions, just assignments with expressions all strictly dealing with LayoutUnits. Fixed.
EWS
Comment 25 2021-08-01 21:56:07 PDT
Committed r280525 (240157@main): <https://commits.webkit.org/240157@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 434715 [details].
Note You need to log in before you can comment on or make changes to this bug.