Clean up some code around RenderElement::addLayers()
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].
<rdar://problem/87722144>