Use lineageOfType to simplify two rendering helpers.
[WebKit-https.git] / Source / WebCore / rendering / RenderRuby.cpp
index 9facf6fb6fb7455e08b01e54a52085eab35b30f6..f0344ca6aa51becec2d1c570e0dda523961c2430 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "RenderRuby.h"
 
+#include "RenderIterator.h"
 #include "RenderRubyRun.h"
 #include "RenderStyle.h"
 #include "StyleInheritedData.h"
@@ -101,11 +102,7 @@ static RenderRubyRun* lastRubyRun(const RenderElement* ruby)
 
 static inline RenderRubyRun& findRubyRunParent(RenderObject& child)
 {
-    RenderObject* ancestor = &child;
-    while (ancestor && !ancestor->isRubyRun())
-        ancestor = ancestor->parent();
-    ASSERT(ancestor);
-    return toRenderRubyRun(*ancestor);
+    return *lineageOfType<RenderRubyRun>(child).first();
 }
 
 //=== ruby as inline object ===