| Summary: | Clean up some code around RenderElement::addLayers() | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||
| Component: | Layout and Rendering | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | bfulgham, changseok, darin, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 235194 | ||||||
| Attachments: |
|
||||||
|
Description
Simon Fraser (smfr)
2022-01-15 12:51:14 PST
Created attachment 449267 [details]
Patch
Comment on attachment 449267 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449267&action=review > Source/WebCore/rendering/RenderElement.cpp:640 > + if (!beforeChild.has_value()) You can omit the ".has_value()" if you like. But if you think including it makes the code clearer, that’s fine. > Source/WebCore/rendering/RenderElement.cpp:643 > + parentLayer.addChild(*downcast<RenderLayerModelObject>(currentRenderer).layer(), beforeChild.value()); I often prefer *beforeChild, treating an optional as if it was a pointer, but if you like value() better, I’m OK with it. > Source/WebCore/rendering/RenderElement.cpp:699 > + for (auto* child = siblingToTraverseFrom ? siblingToTraverseFrom->nextSibling() : firstChild(); child; child = child->nextSibling()) { Seems like childAfter helper function, either member or non-member, that returns first if the argument is nullptr and nextSibling if it’s not would make this nicer to read. When dealing with optionals of bools or pointers I like using the explicit has_value() and value() functions. Committed r288127 (246137@main): <https://commits.webkit.org/246137@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 449267 [details]. |