[webkit-reviews] review granted: [Bug 235272] Clean up some code around RenderElement::addLayers() : [Attachment 449267] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jan 15 14:27:38 PST 2022

Darin Adler <darin at apple.com> has granted Simon Fraser (smfr)
<simon.fraser at apple.com>'s request for review:
Bug 235272: Clean up some code around RenderElement::addLayers()

Attachment 449267: Patch


--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 449267
  --> https://bugs.webkit.org/attachment.cgi?id=449267

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
> +	  
, 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.

More information about the webkit-reviews mailing list