2009-02-03  David Hyatt  <hyatt@apple.com>

        Reduce the number of calls to virtualChildren (indirectly made via RenderObject::firstChild()).
        This is a small gain on the PLT.

        Reviewed by Mark Rowe

        * rendering/bidi.cpp:
        (WebCore::inlineWidth):
        (WebCore::bidiNext):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 3f9cd73..451a2ed 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -103,9 +103,9 @@
     int extraWidth = 0;
     RenderObject* parent = child->parent();
     while (parent->isBox() && parent->isInline() && !parent->isInlineBlockOrInlineTable() && lineDepth++ < cMaxLineDepth) {
-        if (start && parent->firstChild() == child)
+        if (start && !child->previousSibling())
             extraWidth += getBorderPaddingMargin(toRenderBox(parent), false);
-        if (end && parent->lastChild() == child)
+        if (end && !child->nextSibling())
             extraWidth += getBorderPaddingMargin(toRenderBox(parent), true);
         child = parent;
         parent = child->parent();
@@ -173,7 +173,7 @@
 
     while (current) {
         next = 0;
-        if (!oldEndOfInline && !current->isFloating() && !current->isReplaced() && !current->isPositioned()) {
+        if (!oldEndOfInline && !current->isFloating() && !current->isReplaced() && !current->isPositioned() && !current->isText()) {
             next = current->firstChild();
             if (next && resolver && next->isRenderInline()) {
                 EUnicodeBidi ub = next->style()->unicodeBidi();