Add lineageOfType renderer iterator and start using it.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 23:19:40 +0000 (23:19 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 23:19:40 +0000 (23:19 +0000)
commite03868e9f193961911c02c46adefa6bd74b37111
treeaad2fba9b5acd4c05ebe0b1186ebc27e84413bc6
parent5cfa0854d389847d7832b4833cf335bc56198a13
Add lineageOfType renderer iterator and start using it.
<https://webkit.org/b/126456>

Add a convenient way to iterate over a renderers ancestry *including*
the starting point renderer (if it meets the type criteria.)

This works just like lineageOfType for Elements.

Reviewed by Geoffrey Garen.

* rendering/RenderAncestorIterator.h:
(WebCore::lineageOfType):

    Added. Returns an adapter for walking a renderer's entire lineage
    matching any renderer of the given type.

* rendering/RenderBoxModelObject.h:
* rendering/RenderLayerModelObject.h:

    Add the requisite isRendererOfType<T> helpers.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::enclosingFloatPaintingLayer):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::enclosingLayer):
(WebCore::RenderObject::enclosingBox):
(WebCore::RenderObject::enclosingBoxModelObject):

    Simplify with lineageOfType. Added some FIXMEs about functions
    that should return references instead of pointers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderAncestorIterator.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderLayerModelObject.h
Source/WebCore/rendering/RenderObject.cpp