[webkit-changes] cvs commit: WebCore/khtml/rendering bidi.cpp
Adele
adele at opensource.apple.com
Fri Aug 12 01:47:42 PDT 2005
adele 05/08/12 01:47:42
Modified: . Tag: Safari-2-0-branch ChangeLog
khtml/rendering Tag: Safari-2-0-branch bidi.cpp
Log:
Merged fixes from TOT to Safari-2-0-branch
<rdar://problem/4213775> Several fixes in WebCore's bidi algorithm
Revision Changes Path
No revision
No revision
1.4104.2.111 +72 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4104.2.110
retrieving revision 1.4104.2.111
diff -u -r1.4104.2.110 -r1.4104.2.111
--- ChangeLog 12 Aug 2005 01:35:13 -0000 1.4104.2.110
+++ ChangeLog 12 Aug 2005 08:47:27 -0000 1.4104.2.111
@@ -1,3 +1,75 @@
+2005-08-12 Adele Peterson <adele at apple.com>
+
+ Merged fixes from TOT to Safari-2-0-branch
+ <rdar://problem/4213775> Several fixes in WebCore's bidi algorithm
+
+ 2005-06-24 Darin Adler <darin at apple.com>
+
+ Changes by Mitz Pettel.
+ Reviewed by me.
+
+ - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3693>
+ Bug_72578 in KHTML: bidi algorithm misbehaves with CS after AN
+
+ * khtml/rendering/bidi.cpp: (khtml::RenderBlock::bidiReorderLine): Rolled in the
+ patch from the KDE tree.
+
+ 2005-06-24 Darin Adler <darin at apple.com>
+
+ Changes by Mitz Pettel.
+ Reviewed by me.
+
+ - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3599>
+ Incorrect layout of explicit embedding levels
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::embed): Set up the new run correctly following an embed/pop.
+ (khtml::RenderBlock::bidiReorderLine): Close the "dangling" run when we see an explicit
+ embedding character (or PDF).
+
+ 2005-06-22 Darin Adler <darin at apple.com>
+
+ Changes by Mitz Pettel.
+ Reviewed by me.
+
+ - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3633>
+ Layout order of bidi level runs is incorrect
+
+ * khtml/rendering/bidi.cpp: (khtml::RenderBlock::bidiReorderLine): Fixed mistake
+ where we'd advance too far after reversing a run.
+
+ 2005-07-05 Geoffrey Garen <ggaren at apple.com>
+
+ Rolled in patch by opendarwin.org at mitzpettel.com
+
+ -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3733
+ Incorrect bidi layout of ETs, ANs, and ENs in some contexts
+
+ Reviewed by hyatt.
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::appendRun):
+ (khtml::RenderBlock::bidiReorderLine):
+ (khtml::RenderBlock::layoutInlineChildren):
+
+ 2005-07-19 Geoffrey Garen <ggaren at apple.com>
+
+ - rolled in patch by opendarwin.org at mitzpettel.com for
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=3838
+ Text runs unnecessarily split at EN L boundaries
+
+ Reviewed by hyatt.
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::RenderBlock::bidiReorderLine):
+
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::appendRun):
+ (khtml::embed):
+ (khtml::RenderBlock::bidiReorderLine):
+ (khtml::RenderBlock::layoutInlineChildren):
+
2005-08-11 Adele Peterson <adele at apple.com>
Merged fix from TOT to Safari-2-0-branch
No revision
No revision
1.125.8.4 +81 -66 WebCore/khtml/rendering/bidi.cpp
Index: bidi.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
retrieving revision 1.125.8.3
retrieving revision 1.125.8.4
diff -u -r1.125.8.3 -r1.125.8.4
--- bidi.cpp 9 Aug 2005 17:52:26 -0000 1.125.8.3
+++ bidi.cpp 12 Aug 2005 08:47:41 -0000 1.125.8.4
@@ -541,7 +541,8 @@
static void appendRun( BidiState &bidi )
{
- if ( emptyRun ) return;
+ if (emptyRun || !bidi.eor.obj)
+ return;
#if BIDI_DEBUG > 1
kdDebug(6041) << "appendRun: dir="<<(int)dir<<endl;
#endif
@@ -626,10 +627,10 @@
bidi.context = new BidiContext(level, runDir, bidi.context, override);
bidi.context->ref();
- if ( override )
dir = runDir;
bidi.status.last = runDir;
bidi.status.lastStrong = runDir;
+ bidi.status.eor = runDir;
}
}
adjustEmbedding = b;
@@ -884,21 +885,10 @@
// context->ref();
- dir = QChar::DirON;
-
- // Adopt the directionality of the text's element if specified as RTL
- // and the first position is neutral.
- if (start.direction() == QChar::DirON) {
- if (start.obj) {
- if (start.obj->style()->direction() == RTL)
- dir = QChar::DirR;
- }
- else if (style()->direction() == RTL) {
- dir = QChar::DirR;
- }
- }
+ dir = bidi.context->dir;
emptyRun = true;
+ bidi.eor.obj = 0;
numSpaces = 0;
@@ -934,7 +924,6 @@
case QChar::DirRLO:
case QChar::DirLRO:
case QChar::DirPDF:
- bidi.eor = bidi.last;
embed( dirCurrent, bidi );
break;
@@ -944,13 +933,17 @@
dir = QChar::DirL;
switch(bidi.status.last)
{
- case QChar::DirL:
- bidi.eor = bidi.current; bidi.status.eor = QChar::DirL; break;
case QChar::DirR:
case QChar::DirAL:
case QChar::DirEN:
case QChar::DirAN:
- appendRun( bidi );
+ if (bidi.status.last != QChar::DirEN || bidi.status.lastStrong != QChar::DirL)
+ appendRun( bidi );
+ dir = QChar::DirL;
+ // fall through
+ case QChar::DirL:
+ bidi.eor = bidi.current;
+ bidi.status.eor = QChar::DirL;
break;
case QChar::DirES:
case QChar::DirET:
@@ -960,30 +953,42 @@
case QChar::DirS:
case QChar::DirWS:
case QChar::DirON:
- if(dir != QChar::DirL) {
- //last stuff takes embedding dir
- if( bidi.context->dir == QChar::DirR ) {
- if(!(bidi.status.eor == QChar::DirR)) {
- // AN or EN
- appendRun( bidi );
+ if (bidi.status.eor == QChar::DirEN) {
+ if (bidi.status.lastStrong != QChar::DirL) {
+ // the numbers need to be on a higher embedding level, so let's close that run
+ dir = QChar::DirEN;
+ appendRun(bidi);
+ if (bidi.context->dir != QChar::DirL) {
+ // the neutrals take the embedding direction, which is R
+ bidi.eor = bidi.last;
dir = QChar::DirR;
+ appendRun(bidi);
}
- else
- bidi.eor = bidi.last;
+ }
+ } else if (bidi.status.eor == QChar::DirAN) {
+ // Arabic numbers are always on a higher embedding level, so let's close that run
+ dir = QChar::DirAN;
+ appendRun(bidi);
+ if (bidi.context->dir != QChar::DirL) {
+ // the neutrals take the embedding direction, which is R
+ bidi.eor = bidi.last;
+ dir = QChar::DirR;
+ appendRun(bidi);
+ }
+ } else if(bidi.status.eor != QChar::DirL) {
+ //last stuff takes embedding dir
+ if(bidi.context->dir == QChar::DirL || bidi.status.lastStrong == QChar::DirL) {
+ if (bidi.status.eor != QChar::DirON)
appendRun( bidi );
- dir = QChar::DirL;
- bidi.status.eor = QChar::DirL;
} else {
- if(bidi.status.eor == QChar::DirR) {
- 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 );
}
- } else {
- bidi.eor = bidi.current; bidi.status.eor = QChar::DirL;
}
+ bidi.eor = bidi.current;
+ bidi.status.eor = QChar::DirL;
+ dir = QChar::DirL;
default:
break;
}
@@ -1015,12 +1020,14 @@
case QChar::DirON:
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;
bidi.eor = bidi.current;
bidi.status.eor = QChar::DirR;
} else {
+ dir = QChar::DirL;
bidi.eor = bidi.last;
appendRun( bidi );
dir = QChar::DirR;
@@ -1044,9 +1051,6 @@
if(!(bidi.status.lastStrong == QChar::DirAL)) {
// 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;
}
switch(bidi.status.last)
@@ -1123,7 +1127,7 @@
break;
case QChar::DirCS:
if(bidi.status.eor == QChar::DirAN) {
- bidi.eor = bidi.current; bidi.status.eor = QChar::DirR; break;
+ bidi.eor = bidi.current; break;
}
case QChar::DirES:
case QChar::DirET:
@@ -1132,28 +1136,32 @@
case QChar::DirS:
case QChar::DirWS:
case QChar::DirON:
- if(bidi.status.eor == QChar::DirR) {
- // neutrals go to R
- bidi.eor = bidi.last;
- appendRun( bidi );
- dir = QChar::DirAN;
- bidi.status.eor = QChar::DirAN;
- } else if( bidi.status.eor == QChar::DirL ||
- (bidi.status.eor == QChar::DirEN && bidi.status.lastStrong == QChar::DirL)) {
- bidi.eor = bidi.current; bidi.status.eor = dirCurrent;
- } else {
- // numbers on both sides, neutrals get right to left direction
- if(dir != QChar::DirL) {
+ if(bidi.status.eor != QChar::DirR && bidi.status.eor != QChar::DirAL) {
+ // run of L before neutrals, neutrals take embedding dir (N2)
+ if(bidi.context->dir == QChar::DirR || bidi.status.lastStrong == QChar::DirR
+ || bidi.status.lastStrong == QChar::DirAL) {
+ // the embedding direction is R
+ // close the L run
appendRun( bidi );
+ // neutrals become an R run
bidi.eor = bidi.last;
dir = QChar::DirR;
appendRun( bidi );
- dir = QChar::DirAN;
- bidi.status.eor = QChar::DirAN;
+ bidi.eor = bidi.current;
} else {
- bidi.eor = bidi.current; bidi.status.eor = dirCurrent;
+ // the embedding direction is L
+ // append neutrals to the L run and close it
+ dir = QChar::DirL;
+ bidi.eor = bidi.last;
+ appendRun(bidi);
}
+ } else {
+ bidi.eor = bidi.last;
+ appendRun(bidi);
+ bidi.eor = bidi.current;
}
+ dir = QChar::DirAN;
+ bidi.status.eor = QChar::DirAN;
default:
break;
}
@@ -1166,6 +1174,17 @@
dirCurrent = QChar::DirEN;
bidi.eor = bidi.current; bidi.status.eor = dirCurrent;
break;
+ } else if ((bidi.status.eor == QChar::DirR || bidi.status.eor == QChar::DirAL || bidi.status.eor == QChar::DirAN || (bidi.status.eor == QChar::DirEN && bidi.status.lastStrong == QChar::DirR)) && bidi.last!=bidi.current) {
+ // most of the time this is unnecessary, but we need to secure the R run in case
+ // the ET ends up being neutral and followed by L
+ if (bidi.status.last!=QChar::DirET) {
+ dir = bidi.status.eor;
+ appendRun(bidi);
+ bidi.eor = bidi.last;
+ }
+ bidi.status.eor = QChar::DirR;
+ dir = QChar::DirR;
+ break;
}
break;
@@ -1195,6 +1214,9 @@
switch(dirCurrent)
{
case QChar::DirET:
+ if (bidi.status.last != QChar::DirEN)
+ bidi.status.last = QChar::DirET;
+ break;
case QChar::DirES:
case QChar::DirCS:
case QChar::DirS:
@@ -1218,10 +1240,6 @@
// ignore these
break;
case QChar::DirEN:
- if ( bidi.status.last == QChar::DirL ) {
- bidi.status.last = QChar::DirL;
- break;
- }
// fall through
default:
bidi.status.last = dirCurrent;
@@ -1233,7 +1251,6 @@
if ( emptyRun ) {
bidi.sor = bidi.current;
- bidi.eor = bidi.current;
emptyRun = false;
}
@@ -1308,8 +1325,6 @@
}
int end = i-1;
reverseRuns(start, end);
- i++;
- if(i >= count) break;
}
levelHigh--;
}
@@ -1458,8 +1473,8 @@
}
startEmbed->ref();
- bidi.status.lastStrong = QChar::DirON;
- bidi.status.last = QChar::DirON;
+ bidi.status.lastStrong = startEmbed->dir;
+ bidi.status.last = startEmbed->dir;
bidi.context = startEmbed;
if (!smidpoints)
More information about the webkit-changes
mailing list