Bug 206792

Summary: [LFC][IFC] Layout logic should be driven by the type of the inline box
Product: WebKit Reporter: alan <zalan>
Component: Layout and RenderingAssignee: alan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, koivisto, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

alan
Reported 2020-01-24 18:58:07 PST
ssia
Attachments
Patch (7.77 KB, patch)
2020-01-24 19:02 PST, alan
no flags
Patch (8.30 KB, patch)
2020-01-25 06:36 PST, alan
no flags
Radar WebKit Bug Importer
Comment 1 2020-01-24 18:58:24 PST
alan
Comment 2 2020-01-24 19:02:25 PST
Antti Koivisto
Comment 3 2020-01-24 23:59:20 PST
Comment on attachment 388753 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388753&action=review > Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:68 > static inline const Box* nextInPreOrder(const Box& layoutBox, const Container& stayWithin) > { > - const Box* nextInPreOrder = nullptr; > - if (!layoutBox.establishesFormattingContext() && is<Container>(layoutBox) && downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) > - return downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); > - > - for (nextInPreOrder = &layoutBox; nextInPreOrder && nextInPreOrder != &stayWithin; nextInPreOrder = nextInPreOrder->parent()) { > - if (auto* nextSibling = nextInPreOrder->nextInFlowOrFloatingSibling()) > - return nextSibling; > + auto opaqueBox = layoutBox.isFloatingPositioned() || layoutBox.isAtomicInlineLevelBox(); > + if (opaqueBox || layoutBox.isAnonymous() || layoutBox.isLineBreakBox()) { > + for (auto* nextInPreOrder = &layoutBox; nextInPreOrder && nextInPreOrder != &stayWithin; nextInPreOrder = nextInPreOrder->parent()) { > + if (auto* nextSibling = nextInPreOrder->nextInFlowOrFloatingSibling()) > + return nextSibling; > + } > + return nullptr; > } > - return nullptr; > + ASSERT(layoutBox.isInlineBox()); > + return downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); > } I feel this is making previously robust and understandable pre-order traversal code much less so. How de we know at the end this is a Container that is guaranteed to have at least one child?
alan
Comment 4 2020-01-25 04:13:28 PST
(In reply to Antti Koivisto from comment #3) > Comment on attachment 388753 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=388753&action=review > > > Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:68 > > static inline const Box* nextInPreOrder(const Box& layoutBox, const Container& stayWithin) > > { > > - const Box* nextInPreOrder = nullptr; > > - if (!layoutBox.establishesFormattingContext() && is<Container>(layoutBox) && downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) > > - return downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); > > - > > - for (nextInPreOrder = &layoutBox; nextInPreOrder && nextInPreOrder != &stayWithin; nextInPreOrder = nextInPreOrder->parent()) { > > - if (auto* nextSibling = nextInPreOrder->nextInFlowOrFloatingSibling()) > > - return nextSibling; > > + auto opaqueBox = layoutBox.isFloatingPositioned() || layoutBox.isAtomicInlineLevelBox(); > > + if (opaqueBox || layoutBox.isAnonymous() || layoutBox.isLineBreakBox()) { > > + for (auto* nextInPreOrder = &layoutBox; nextInPreOrder && nextInPreOrder != &stayWithin; nextInPreOrder = nextInPreOrder->parent()) { > > + if (auto* nextSibling = nextInPreOrder->nextInFlowOrFloatingSibling()) > > + return nextSibling; > > + } > > + return nullptr; > > } > > - return nullptr; > > + ASSERT(layoutBox.isInlineBox()); > > + return downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); > > } > > I feel this is making previously robust and understandable pre-order > traversal code much less so. How de we know at the end this is a Container > that is guaranteed to have at least one child? I totally agree. I probably should be doing it the other way around and remove the Container class first since at this point that class is more of a nuisance than an actual help.
alan
Comment 5 2020-01-25 06:36:19 PST
WebKit Commit Bot
Comment 6 2020-01-25 07:57:13 PST
Comment on attachment 388772 [details] Patch Clearing flags on attachment: 388772 Committed r255118: <https://trac.webkit.org/changeset/255118>
WebKit Commit Bot
Comment 7 2020-01-25 07:57:15 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.