RESOLVED FIXED 114853
Make loops in RenderObject::containingBlock homogeneous in their forms to simplify
https://bugs.webkit.org/show_bug.cgi?id=114853
Summary Make loops in RenderObject::containingBlock homogeneous in their forms to sim...
Ryosuke Niwa
Reported 2013-04-18 22:49:10 PDT
Make loops in RenderObject::containingBlock homogeneous in their forms to simplify
Attachments
Cleanup (4.79 KB, patch)
2013-04-18 22:53 PDT, Ryosuke Niwa
no flags
Fixed builds (4.82 KB, patch)
2013-04-18 23:08 PDT, Ryosuke Niwa
no flags
Fixed per comments (4.52 KB, patch)
2013-04-19 11:01 PDT, Ryosuke Niwa
no flags
Removed an obsolete comment (4.45 KB, patch)
2013-04-19 11:14 PDT, Ryosuke Niwa
hyatt: review+
Ryosuke Niwa
Comment 1 2013-04-18 22:53:53 PDT
Ryosuke Niwa
Comment 2 2013-04-18 22:56:01 PDT
Comment on attachment 198805 [details] Cleanup View in context: https://bugs.webkit.org/attachment.cgi?id=198805&action=review > Source/WebCore/rendering/RenderObject.cpp:790 > +static inline isNonInlineRenderBlock() > +{ > + return o->isRenderBlock() && (!o->isInline() || o->isReplaced()); > +} Oops, I obviously didn't upload the right patch.
Ryosuke Niwa
Comment 3 2013-04-18 23:08:18 PDT
Created attachment 198807 [details] Fixed builds
Simon Fraser (smfr)
Comment 4 2013-04-19 08:57:26 PDT
Comment on attachment 198807 [details] Fixed builds View in context: https://bugs.webkit.org/attachment.cgi?id=198807&action=review I'd prefer hyatt do final review. Be careful here, this is hot code! > Source/WebCore/rendering/RenderObject.cpp:807 > + // For a realtively positioned inline, return its nearest non-anonymous containing block, "realtively"
Dave Hyatt
Comment 5 2013-04-19 10:43:46 PDT
Comment on attachment 198807 [details] Fixed builds View in context: https://bugs.webkit.org/attachment.cgi?id=198807&action=review r- > Source/WebCore/rendering/RenderObject.cpp:774 > +static inline bool isNonReplacedInlineInFlowPosition(RenderObject* object) > +{ > + return object->style()->hasInFlowPosition() && object->isInline() && !object->isReplaced(); > +} Pretty sure this function has no reason for existing and is just historical from when RenderBlocks could be inline flows because of run-in/compact. I think this can just be isRenderInline() now. > Source/WebCore/rendering/RenderObject.cpp:778 > + // FIXME: This set of conditions can be simplified by combinging the first and the last conditions. Typo. combinging should be combining. > Source/WebCore/rendering/RenderObject.cpp:785 > + || isNonReplacedInlineInFlowPosition(object); I'm pretty sure this can just be isRenderInline(). > Source/WebCore/rendering/RenderObject.cpp:791 > +static inline bool isNonInlineRenderBlock(RenderObject* object) > +{ > + return object->isRenderBlock() && (!object->isInline() || object->isReplaced()); > +} I would invert this function and make it: isNonRenderBlockInline and make the definition (o->isInline() && !o->isReplaced()) || !o->isRenderBlock()) Your version makes a virtual function call right off the bat. Preserve the original code that avoided the virtual function call by using inline/replaced checks first. > Source/WebCore/rendering/RenderObject.cpp:816 > + while (o && !isNonInlineRenderBlock(o)) This can be while (o && isNonRenderBlockInline()) This reads better to me without the negation.
Ryosuke Niwa
Comment 6 2013-04-19 11:01:36 PDT
Created attachment 198900 [details] Fixed per comments
Ryosuke Niwa
Comment 7 2013-04-19 11:14:30 PDT
Created attachment 198903 [details] Removed an obsolete comment
Dave Hyatt
Comment 8 2013-04-19 12:00:22 PDT
Comment on attachment 198903 [details] Removed an obsolete comment r=me
Ryosuke Niwa
Comment 9 2013-04-19 12:50:31 PDT
Thanks for the review!
Ryosuke Niwa
Comment 10 2013-04-19 12:56:49 PDT
Ryosuke Niwa
Comment 11 2013-04-19 15:48:50 PDT
Added a missing null pointer check in http://trac.webkit.org/changeset/148777.
Note You need to log in before you can comment on or make changes to this bug.