RESOLVED FIXED 185158
[LFC] Implement LayoutContext::createDisplayBox
https://bugs.webkit.org/show_bug.cgi?id=185158
Summary [LFC] Implement LayoutContext::createDisplayBox
alan baradlay
Reported 2018-04-30 21:49:30 PDT
and introduce LayoutPair (better name is welcome!)
Attachments
Patch (19.95 KB, patch)
2018-04-30 21:54 PDT, alan baradlay
no flags
Patch (20.91 KB, patch)
2018-05-02 19:52 PDT, alan baradlay
no flags
alan baradlay
Comment 1 2018-04-30 21:54:29 PDT
Antti Koivisto
Comment 2 2018-05-02 06:05:40 PDT
Comment on attachment 339184 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=339184&action=review > Source/WebCore/layout/FormattingContext.h:61 > + struct LayoutPair { > + const Box& layoutBox; > + Display::Box& displayBox; > + }; Have you considered simply not having this type or only using it in LayoutQueue? Passing these as separate parameters might end up reading better in code ('layoutPair.layoutBox' -> 'layoutBox'). Also it makes it clear in all functions signatures that one is const and one is not. LayoutQueue could still use this or use std::pair. > Source/WebCore/layout/LayoutContext.cpp:61 > + auto* parentDisplayBox = this->displayBox(*parentLayoutBox); Maybe displayBox() should be renamed to something like findDisplayBox() or displayBoxForLayoutBox()? > Source/WebCore/layout/LayoutContext.cpp:64 > + auto* displayBox = new Display::Box(); Please use std::unique_ptr for memory management. > Source/WebCore/layout/LayoutContext.cpp:74 > + if (!parentDisplayBox->firstChild()) { > + parentDisplayBox->setFirstChild(*displayBox); > + parentDisplayBox->setLastChild(*displayBox); > + } else { > + auto* previousSibling = parentDisplayBox->lastChild(); > + displayBox->setPreviousSibling(*previousSibling); > + previousSibling->setNextSibling(*displayBox); > + parentDisplayBox->setLastChild(*displayBox); > + } It is not obvious to me why this function appends the box as last child. Wouldn't this be wrong if it is called for layoutBox that is not the last child and the subsequent siblings have display boxes already? Some of this stuff should probably be encapsulated to Display::Box::addChild(std::unique_ptr<Display::Box>, Display::Box* afterChild) or similar (like it is now in render tree).
alan baradlay
Comment 3 2018-05-02 19:52:50 PDT
WebKit Commit Bot
Comment 4 2018-05-02 20:19:38 PDT
Comment on attachment 339380 [details] Patch Clearing flags on attachment: 339380 Committed r231293: <https://trac.webkit.org/changeset/231293>
WebKit Commit Bot
Comment 5 2018-05-02 20:19:39 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2018-05-02 20:20:20 PDT
Note You need to log in before you can comment on or make changes to this bug.