Version: (using KDE Devel) Installed from: Compiled sources OS: I Don't Know The directionality of a neutral character at the beginning of a paragraph (or after a hard line break) is decided incorrectly if the first non-neutral character in the paragraph has directionality opposite to the paragraph directionality. For example, if the paragraph direction is LTR, the first character on the paragraph is a question mark and the next one is a Hebrew character, then the question mark will is considered right-to-left and appears to the right of the Hebrew character. The rule to follow is 3.3.4.N2 in the Unicode Standard's Bidirectional Algorithm <http://www.unicode.org/reports/tr9/#Resolving_Neutral_Types>. For example (uppercase letters are R, lowercase are L), <DIV dir="ltr"> ? SLOM hello </DIV> should be rendered as: ? MOLS hello but is currently rendered as: MOLS ? hello and <DIV dir="rtl"> ? hello SLOM </DIV> should be rendered as: MOLS hello ? but is currently rendered as: MOLS ? hello The relevant code seems to be in RenderBlock::bidiReorderLine in khtml/rendering/bidi.cpp, specifically in the handling of the cases ( dirCurrent, status.last ) == ( [L|AL|R], [ES|ET|CS|BN|B|S|WS|ON] ).
Created an attachment (id=8143) [details] test case
Created an attachment (id=8146) [details] Proposed patch for bidi.cpp r1.198 OK, I'm not sure this is the proper way to submit a patch... I cleaned up the code at two places in bidiReorderLine, then I corrected the dirCurrent==[AL|R], bidi.status.last==[ET|ES|CS|BN|B|S|WS|ON] case, then I adapted the same logic to the dirCurrent==L, bidi.status.last==[ET|ES|CS|BN|B|S|WS|ON] case. Also set dir and status.eor after the appendRun in the dirCurrent==L, bidi.status.last==[R|AL|EN|AN] case, for consistency and clarity.
you should post your patch to kfm-devel@kde.org. Not all developers read the bug list - due to the mass of bug reports we get and the little time developers have.
Patch posted to kfm-devel. http://lists.kde.org/?l=kfm-devel&m=109943744500671&w=2
Created an attachment (id=8149) [details] Proposed patch for bidi.cpp r1.198
(From update of attachment 8149 [details]) The previous patch was completely wrong. Sorry.
Created an attachment (id=8153) [details] Proposed patch for bidi.cpp r1.198 Revised patch
Created an attachment (id=8170) [details] Proposed patch for bidi.cpp r1.198 Revised patch
CVS commit by coolo: applying the patch BUG: 91955 M +5 -0 ChangeLog 1.327 M +18 -21 rendering/bidi.cpp 1.199 --- kdelibs/khtml/ChangeLog #1.326:1.327 @@ -1,2 +1,7 @@ +2004-11-04 Stephan Kulow <coolo@kde.org> + + * rendering/bidi.cpp (bidiReorderLine): applying patch by Mitz Pettel + to fix neutral types at beginning of context + 2004-11-03 Germain Garand <germain@ebooksfrance.com> --- kdelibs/khtml/rendering/bidi.cpp #1.198:1.199 @@ -857,24 +857,23 @@ void RenderBlock::bidiReorderLine(const case QChar::DirWS: case QChar::DirON: - if(dir != QChar::DirL) { + if( bidi.status.eor != QChar::DirL ) { //last stuff takes embedding dir - if( bidi.context->dir == QChar::DirR ) { - if(!(bidi.status.eor == QChar::DirR)) { - // AN or EN - appendRun( bidi ); - dir = QChar::DirR; - } - else - bidi.eor = bidi.last; + if(bidi.context->dir == QChar::DirL || bidi.status.lastStrong == QChar::DirL) { + if ( bidi.status.eor != QChar::DirEN && bidi.status.eor != QChar::DirAN && bidi.status.eor != QChar::DirON ) appendRun( bidi ); dir = QChar::DirL; + bidi.eor = bidi.current; bidi.status.eor = QChar::DirL; } else { - if(bidi.status.eor == QChar::DirR) { + if ( bidi.status.eor == QChar::DirEN || bidi.status.eor == QChar::DirAN ) + { + dir = bidi.status.eor; appendRun( bidi ); - dir = QChar::DirL; - } else { - bidi.eor = bidi.current; bidi.status.eor = QChar::DirL; break; } + dir = QChar::DirR; + bidi.eor = bidi.last; + appendRun( bidi ); + dir = QChar::DirL; + bidi.status.eor = QChar::DirL; } } else { @@ -912,5 +911,6 @@ void RenderBlock::bidiReorderLine(const if( !(bidi.status.eor == QChar::DirR) && !(bidi.status.eor == QChar::DirAL) ) { //last stuff takes embedding dir - if(bidi.context->dir == QChar::DirR || bidi.status.lastStrong == QChar::DirR) { + if(bidi.context->dir == QChar::DirR || bidi.status.lastStrong == QChar::DirR + || bidi.status.lastStrong == QChar::DirAL) { appendRun( bidi ); dir = QChar::DirR; @@ -918,4 +918,5 @@ void RenderBlock::bidiReorderLine(const bidi.status.eor = QChar::DirR; } else { + dir = QChar::DirL; bidi.eor = bidi.last; appendRun( bidi ); @@ -941,7 +942,4 @@ void RenderBlock::bidiReorderLine(const // if last strong was AL change EN to AN if(dir == QChar::DirON) { - if(bidi.status.lastStrong == QChar::DirAL) - dir = QChar::DirAN; - else dir = QChar::DirL; } @@ -1116,5 +1114,4 @@ void RenderBlock::bidiReorderLine(const case QChar::DirEN: if ( bidi.status.last == QChar::DirL ) { - bidi.status.last = QChar::DirL; break; }
CVS commit by coolo: updating baseline of fixed test cases CCBUG: 91955 A baseline/unsorted/91955.html-dump.png 1.1 A baseline/unsorted/91955.html-render 1.1 A tests/unsorted/91955.html 1.1 M baseline/meyerweb.com/css2-tests/sec09-10a.htm-dump.png 1.7 M +2 -1 baseline/meyerweb.com/css2-tests/sec09-10a.htm-render 1.9 M baseline/meyerweb.com/css2-tests/sec09-10b.htm-dump.png 1.8 M +12 -9 baseline/meyerweb.com/css2-tests/sec09-10b.htm-render 1.9 M +1 -0 baseline/unsorted/.cvsignore 1.17 M baseline/unsorted/62904.html-dump.png 1.2 M +4 -3 baseline/unsorted/62904.html-render 1.2 M +0 -3 baseline/unsorted/minheight.html-render 1.4 M +1 -1 baseline/webcore/fast/lists/001.html-render 1.10
You need to log in before you can comment on or make changes to this bug.