Fix for 3257990, attributes in HTML should always be case-insensitive
	when matching CSS attribute selectors.  Instead of relying on
	the strict mode check, I patched the code to use an isXMLDoc
	bool instead.

	Also fixing a problem where <pre>s are mistakenly justifying their
	text when text-align: justify is set.

        Reviewed by kocienda

        * ChangeLog:
        * khtml/css/cssstyleselector.cpp:
        * khtml/css/cssstyleselector.h:
        * khtml/rendering/bidi.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index 2b1b430..39f4555 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -676,11 +676,16 @@
                 for ( int i = r->start; i < r->stop; i++ )
                     if ( static_cast<RenderText *>(r->obj)->text()[i].direction() == QChar::DirWS )
                         spaces++;
+
                 KHTMLAssert(spaces <= numSpaces);
-                spaceAdd = (availableWidth - totWidth)*spaces/numSpaces;
+
+                // Only justify text with white-space: normal.
+                if (r->obj->style()->whiteSpace() != PRE) {
+                    spaceAdd = (availableWidth - totWidth)*spaces/numSpaces;
+                    static_cast<TextRun*>(r->box)->setSpaceAdd(spaceAdd);
+                    totWidth += spaceAdd;
+                }
                 numSpaces -= spaces;
-                totWidth += spaceAdd;
-                static_cast<TextRun*>(r->box)->setSpaceAdd(spaceAdd);
             }
         }
     }