WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
157811
Use RenderChildIterator more for traversing a renderer's children
https://bugs.webkit.org/show_bug.cgi?id=157811
Summary
Use RenderChildIterator more for traversing a renderer's children
Chris Dumez
Reported
2016-05-17 14:25:27 PDT
Use RenderChildIterator more for traversal a renderer's children.
Attachments
Patch
(53.67 KB, patch)
2016-05-17 14:27 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(53.68 KB, patch)
2016-05-17 14:28 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(53.67 KB, patch)
2016-05-17 15:07 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Fix Darin's findings
(2.13 KB, patch)
2016-05-17 16:54 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Fix Darin's findings
(2.15 KB, patch)
2016-05-17 16:55 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2016-05-17 14:27:31 PDT
Created
attachment 279165
[details]
Patch
Chris Dumez
Comment 2
2016-05-17 14:28:51 PDT
Created
attachment 279166
[details]
Patch
Antti Koivisto
Comment 3
2016-05-17 15:03:14 PDT
Comment on
attachment 279166
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=279166&action=review
> Source/WebCore/rendering/RenderBlock.cpp:3471 > + for (auto& box : childrenOfType<RenderBox>(*this)) { > + if (is<RenderText>(box) || is<RenderListMarker>(box)) > + continue;
RenderBox (or RenderElement) is never a RenderText so the test is unnecessary. For DOM classes we have static asserts against at least some types of unnecessary tests. It might be good to add something like that at least for the RenderText case.
> Source/WebCore/rendering/RenderObject.cpp:175 > + if (!is<RenderElement>(*this)) > + return; > + > + for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this))) {
Probably an indication the code should move to RenderElement in the future.
> Source/WebCore/rendering/svg/SVGRenderSupport.cpp:159 > + for (auto& current : childrenOfType<RenderObject>(container)) {
Some of these could probably be tightened to RenderElement
Chris Dumez
Comment 4
2016-05-17 15:07:22 PDT
Created
attachment 279169
[details]
Patch
WebKit Commit Bot
Comment 5
2016-05-17 15:38:03 PDT
Comment on
attachment 279169
[details]
Patch Clearing flags on attachment: 279169 Committed
r201052
: <
http://trac.webkit.org/changeset/201052
>
WebKit Commit Bot
Comment 6
2016-05-17 15:38:10 PDT
All reviewed patches have been landed. Closing bug.
Chris Dumez
Comment 7
2016-05-17 16:22:33 PDT
Comment on
attachment 279166
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=279166&action=review
>> Source/WebCore/rendering/RenderBlock.cpp:3471 >> + continue; > > RenderBox (or RenderElement) is never a RenderText so the test is unnecessary. For DOM classes we have static asserts against at least some types of unnecessary tests. It might be good to add something like that at least for the RenderText case.
I will update the static assertion in is<>() to catch these via
https://bugs.webkit.org/show_bug.cgi?id=157817
Darin Adler
Comment 8
2016-05-17 16:47:23 PDT
Comment on
attachment 279165
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=279165&action=review
> Source/WebCore/ChangeLog:3 > + Use RenderChildIterator more for traversal a renderer's children
traversal of a
> Source/WebCore/rendering/RenderFieldset.cpp:130 > + for (auto& legend : childrenOfType<RenderElement>(*this)) {
Should be RenderBox.
> Source/WebCore/rendering/RenderFieldset.cpp:135 > + return &downcast<RenderBox>(legend);
Not sure why this cast is safe if someone sets an unusual display style on an HTMLLegendElement, but even if it is OK, I see no value in doing the additional processing on the other RenderElement objects that are not RenderBox.
> Source/WebCore/rendering/svg/SVGRenderSupport.cpp:269 > + if (layoutSizeChanged && is<SVGElement>(child.node())) {
This adds a null check that was not in the old code.
Chris Dumez
Comment 9
2016-05-17 16:54:29 PDT
Created
attachment 279185
[details]
Fix Darin's findings
Chris Dumez
Comment 10
2016-05-17 16:55:26 PDT
Created
attachment 279187
[details]
Fix Darin's findings
Chris Dumez
Comment 11
2016-05-17 17:55:13 PDT
Reopen to fix nits.
WebKit Commit Bot
Comment 12
2016-05-17 18:25:13 PDT
Comment on
attachment 279187
[details]
Fix Darin's findings Clearing flags on attachment: 279187 Committed
r201064
: <
http://trac.webkit.org/changeset/201064
>
WebKit Commit Bot
Comment 13
2016-05-17 18:25:19 PDT
All reviewed patches have been landed. Closing bug.
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