Reverted the code part of r16696, my patch for <rdar://problem/4641262>, because the problem was
        addressed at a deeper level by r16696, the patch for <http://bugs.webkit.org/show_bug.cgi?id=10842>.
        Left the layout test.
        
        * rendering/bidi.cpp:
        (WebCore::checkMidpoints):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 71c158d..e31aa32 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -104,8 +104,6 @@
 static bool emptyRun = true;
 static int numSpaces;
 
-static const unsigned short nonBreakingSpace = 0xa0;
-
 static void embed(UCharDirection, BidiState&);
 static void appendRun(BidiState&);
 
@@ -503,17 +501,6 @@
     }
 }
 
-static bool isTrimmable(RenderText* textObj, unsigned int index)
-{
-    ASSERT(index < textObj->length());
-    
-    // FIXME: Also ask ICU whether character is whitespace? Seems expensive. Is it needed for correctness?
-    UChar c = textObj->text()[index];
-    return c == ' ' || c == '\t' ||
-            (c == '\n' && !textObj->style()->preserveNewline()) ||
-            (c == nonBreakingSpace && textObj->style()->nbspMode() == SPACE);
-}
-
 static void checkMidpoints(BidiIterator& lBreak, BidiState& bidi)
 {
     // Check to see if our last midpoint is a start point beyond the line break.  If so,
@@ -531,9 +518,10 @@
             sNumMidpoints--;
             if (endpoint.obj->style()->collapseWhiteSpace()) {
                 if (endpoint.obj->isText()) {
+                    // Don't shave a character off the endpoint if it was from a soft hyphen.
                     RenderText* textObj = static_cast<RenderText*>(endpoint.obj);
                     if (endpoint.pos+1 < textObj->length()) {
-                        if (!isTrimmable(textObj, endpoint.pos+1))
+                        if (textObj->text()[endpoint.pos+1] == SOFT_HYPHEN)
                             return;
                     } else if (startpoint.obj->isText()) {
                         RenderText *startText = static_cast<RenderText*>(startpoint.obj);
@@ -1907,6 +1895,8 @@
     return false;
 }
 
+static const unsigned short nonBreakingSpace = 0xa0;
+
 static inline bool skipNonBreakingSpace(BidiIterator &it)
 {
     if (it.obj->style()->nbspMode() != SPACE || it.current() != nonBreakingSpace)