Bug 236183 - [LFC][IFC] Introduce LineBoxBuilder::setBaselineAndLayoutBounds/layoutBoundsMetricsForInlineBox
Summary: [LFC][IFC] Introduce LineBoxBuilder::setBaselineAndLayoutBounds/layoutBoundsM...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-05 13:43 PST by zalan
Modified: 2022-02-07 14:32 PST (History)
6 users (show)

See Also:


Attachments
Patch (11.91 KB, patch)
2022-02-05 13:50 PST, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2022-02-05 13:43:43 PST
This is in preparation for supporting vertical text.
Comment 1 zalan 2022-02-05 13:50:55 PST
Created attachment 450999 [details]
Patch
Comment 2 EWS 2022-02-06 11:01:22 PST
Committed r289171 (246867@main): <https://commits.webkit.org/246867@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450999 [details].
Comment 3 Radar WebKit Bug Importer 2022-02-06 11:02:17 PST
<rdar://problem/88546530>
Comment 4 Darin Adler 2022-02-06 11:41:17 PST
Comment on attachment 450999 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450999&action=review

> Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:156
> +    std::optional<InlineLayoutUnit> preferredLineHeight { };

Don’t need { } with std:.optional. It’s only scalars that are uninitialized (or classes and structures where we didn’t initialize the scalars in them for some reason). If InlineLayoutUnit was a class we wouldn’t need the { 0 } above either, but I guess it is and we do.
Comment 5 zalan 2022-02-06 12:24:07 PST
(In reply to Darin Adler from comment #4)
> Comment on attachment 450999 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=450999&action=review
> 
> > Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:156
> > +    std::optional<InlineLayoutUnit> preferredLineHeight { };
> 
> Don’t need { } with std:.optional. It’s only scalars that are uninitialized
> (or classes and structures where we didn’t initialize the scalars in them
> for some reason). If InlineLayoutUnit was a class we wouldn’t need the { 0 }
> above either, but I guess it is and we do.
Good point, thanks!
Comment 6 zalan 2022-02-06 21:07:51 PST
(In reply to Darin Adler from comment #4)
> Comment on attachment 450999 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=450999&action=review
> 
> > Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:156
> > +    std::optional<InlineLayoutUnit> preferredLineHeight { };
> 
> Don’t need { } with std:.optional. It’s only scalars that are uninitialized
> (or classes and structures where we didn’t initialize the scalars in them
> for some reason). If InlineLayoutUnit was a class we wouldn’t need the { 0 }
> above either, but I guess it is and we do.

https://trac.webkit.org/changeset/289198/webkit
Comment 7 zalan 2022-02-07 14:14:58 PST
(In reply to Darin Adler from comment #4)
> Comment on attachment 450999 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=450999&action=review
> 
> > Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:156
> > +    std::optional<InlineLayoutUnit> preferredLineHeight { };
> 
> Don’t need { } with std:.optional. It’s only scalars that are uninitialized
> (or classes and structures where we didn’t initialize the scalars in them
> for some reason). If InlineLayoutUnit was a class we wouldn’t need the { 0 }
> above either, but I guess it is and we do.
I remember now. This is why I do it.

./layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:268:97: error: missing field 'preferredLineHeight' initializer [-Werror,-Wmissing-field-initializers]

when calling inlineLevelBox.setLayoutBounds({ layoutBoundsMetrics.ascent, layoutBoundsMetrics.descent });
vs.
inlineLevelBox.setLayoutBounds({ layoutBoundsMetrics.ascent, layoutBoundsMetrics.descent, { }, { } });

maybe I should just get out of the habit of relying on them.
Comment 8 Darin Adler 2022-02-07 14:32:17 PST
OK