WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
235272
Clean up some code around RenderElement::addLayers()
https://bugs.webkit.org/show_bug.cgi?id=235272
Summary
Clean up some code around RenderElement::addLayers()
Simon Fraser (smfr)
Reported
2022-01-15 12:51:14 PST
Clean up some code around RenderElement::addLayers()
Attachments
Patch
(7.82 KB, patch)
2022-01-15 12:54 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2022-01-15 12:54:23 PST
Created
attachment 449267
[details]
Patch
Darin Adler
Comment 2
2022-01-15 14:27:38 PST
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.
Simon Fraser (smfr)
Comment 3
2022-01-18 10:05:02 PST
When dealing with optionals of bools or pointers I like using the explicit has_value() and value() functions.
EWS
Comment 4
2022-01-18 10:45:32 PST
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]
.
Radar WebKit Bug Importer
Comment 5
2022-01-18 10:46:18 PST
<
rdar://problem/87722144
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug