[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml
From:       Charles Samuels <charles () kde ! org>
Date:       2008-01-10 8:12:58
Message-ID: 1199952778.978785.8497.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 759219 by charles:

Support the HTML tag <bdo> (bidirectional override). As a result, support
CSS unicode-bidi: override.

First, don't change two CSS properties in html_elementimpl.cpp as it may
unexpectedly overwrite a previously set property. This allows us to add the
"selector that seems to be still broken" in khtml4.css.

Then make Qt render override text in RTL, even if it's Latin script.

Add a kate variable line because it will make me happy.

Also, fix a bug where it would render <bdo> as not rtl the first time you try
to do bidi stuff in konq (per process). This is because some global (!)
variables were being used unintialized.

There are still some bugs remaining (non-regression) related to the
application of the override. I have some testcases for this but it
requires a sacrifice to the bidi.cpp gods.

BUG:150515



 M  +2 -0      css/cssstyleselector.cpp  
 M  +0 -2      css/html4.css  
 M  +0 -1      html/html_elementimpl.cpp  
 M  +8 -4      rendering/bidi.cpp  
 M  +11 -1     rendering/font.cpp  


--- trunk/KDE/kdelibs/khtml/css/cssstyleselector.cpp #759218:759219
@@ -4119,3 +4119,5 @@
 #endif
 
 } // namespace khtml
+
+// kate: space-indent on; indent-width 4; tab-width 8;
--- trunk/KDE/kdelibs/khtml/css/html4.css #759218:759219
@@ -517,10 +517,8 @@
 	unicode-bidi: bidi-override;
 }
 
-/* ### this selector seems to be still broken ...
       *[dir="ltr"]    { direction: ltr; unicode-bidi: embed }
       *[dir="rtl"]    { direction: rtl; unicode-bidi: embed }
-*/
 
 /* elements that are block-level in html4 */
 /* ### don't support unicode-bidi at the moment
--- trunk/KDE/kdelibs/khtml/html/html_elementimpl.cpp #759218:759219
@@ -207,7 +207,6 @@
         break;
     case ATTR_DIR:
         addCSSProperty(CSS_PROP_DIRECTION, attr->value().lower());
-        addCSSProperty(CSS_PROP_UNICODE_BIDI, CSS_VAL_EMBED);
         break;
 // standard events
     case ATTR_ONCLICK:
--- trunk/KDE/kdelibs/khtml/rendering/bidi.cpp #759218:759219
@@ -92,8 +92,8 @@
 static bool betweenMidpoints;
 
 static bool isLineEmpty = true;
-static bool previousLineBrokeAtBR = true;
-static QChar::Direction dir;
+static bool previousLineBrokeAtBR = false;
+static QChar::Direction dir = QChar::DirON;
 static bool adjustEmbedding;
 static bool emptyRun = true;
 static int numSpaces;
@@ -935,7 +935,6 @@
     bidi.last = bidi.current;
     bool atEnd = false;
     while( 1 ) {
-
         QChar::Direction dirCurrent;
         if (atEnd) {
             //kDebug(6041) << "atEnd";
@@ -944,7 +943,11 @@
                 while ( c->parent )
                     c = c->parent;
             dirCurrent = c->dir;
-        } else {
+        }
+        else if (bidi.context->override) {
+            dirCurrent = bidi.context->dir;
+        }
+        else {
             dirCurrent = bidi.current.direction();
         }
 
@@ -2492,3 +2495,4 @@
 #undef DEBUG_LAYOUT
 
 }
+// kate: space-indent on; indent-width 4; tab-width 8;
\ No newline at end of file
--- trunk/KDE/kdelibs/khtml/rendering/font.cpp #759218:759219
@@ -68,9 +68,19 @@
 static inline void drawDirectedText(QPainter *p, Qt::LayoutDirection d,
     int x, int y, const QString &str)
 {
+    QString qs = str;
+    if (d == Qt::RightToLeft)
+    {
+        // Qt doesn't have a function to force a direction,
+        // so we have to use a the unicode "RTO" character to
+        //  (no, setLayoutDirection isn't enough)
+        if (str[0].direction() == QChar::DirL)
+            qs.prepend(QChar(0x202E));
+    }
+    
     Qt::LayoutDirection saveDir = p->layoutDirection();
     p->setLayoutDirection(d);
-    p->drawText(x, y, str);
+    p->drawText(x, y, qs);
     p->setLayoutDirection(saveDir);
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic