[webkit-reviews] review granted: [Bug 231341] [LFC][IFC] InlineDisplay::Box should be able to tell if it's the first or the last box within the associated Layout::Box : [Attachment 440457] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 7 02:52:09 PDT 2021


Antti Koivisto <koivisto at iki.fi> has granted  review:
Bug 231341: [LFC][IFC] InlineDisplay::Box should be able to tell if it's the
first or the last box within the associated Layout::Box
https://bugs.webkit.org/show_bug.cgi?id=231341

Attachment 440457: Patch

https://bugs.webkit.org/attachment.cgi?id=440457&action=review




--- Comment #2 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 440457
  --> https://bugs.webkit.org/attachment.cgi?id=440457
Patch

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

>
Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp
:47
> +    if (inlineBox.isFirstBox() && inlineBox.isLastBox())
> +	   return { InlineDisplay::Box::PositionWithinInlineLevelBox::First,
InlineDisplay::Box::PositionWithinInlineLevelBox::Last };
> +    if (inlineBox.isFirstBox())
> +	   return { InlineDisplay::Box::PositionWithinInlineLevelBox::First };
> +    if (inlineBox.isLastBox())
> +	   return { InlineDisplay::Box::PositionWithinInlineLevelBox::Last };
> +    return { };

I'd do

OptionSet<InlineDisplay::Box::PositionWithinInlineLevelBox> result;
if (inlineBox.isFirstBox())
    result.add(InlineDisplay::Box::PositionWithinInlineLevelBox::First);
if (inlineBox.isLastBox())
    result.add(InlineDisplay::Box::PositionWithinInlineLevelBox::Last);
return result;

> Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h:147
> +    // These bits are about whether this inline level box is the first/last
generated box of the associated Layout::Box
> +    // (e.g. always true for atomic inline level boxes, but inline boxes
spanning over multiple lines can produce separate first/last boxes).
> +    bool m_isFirstWithinLayoutBox : 1;
> +    bool m_isLastWithinLayoutBox : 1;

These could move up with other bools and probably don't need to be bitfields
(or all of them should be).

>
Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h:135
> +    bool m_isFirstWithinInlineLevelBox : 1;
> +    bool m_isLastWithinInlineLevelBox : 1;

Same here.


More information about the webkit-reviews mailing list