[webkit-changes] cvs commit: WebKit/WebCoreSupport.subproj
WebTextRenderer.h WebTextRenderer.m
Timothy
thatcher at opensource.apple.com
Thu Nov 10 15:29:39 PST 2005
thatcher 05/11/10 15:29:39
Modified: . Tag: Safari-2-0-branch ChangeLog
WebCoreSupport.subproj Tag: Safari-2-0-branch
WebTextRenderer.h WebTextRenderer.m
Log:
Merged fix from TOT to Safari-2-0-branch
2005-07-12 Geoffrey Garen <ggaren at apple.com>
Patch by Mitz Pettel
Added layout test for
http://bugzilla.opendarwin.org/show_bug.cgi?id=3435
Parentheses are backwards in Hebrew text (no bidi mirroring?)
Test is manual because results only reflect visually -
the layout is the same either way.
Test cases added:
* manual-tests/bidi-parens.html: Added.
Revision Changes Path
No revision
No revision
1.3118.4.78 +17 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3118.4.77
retrieving revision 1.3118.4.78
diff -u -r1.3118.4.77 -r1.3118.4.78
--- ChangeLog 10 Nov 2005 20:22:36 -0000 1.3118.4.77
+++ ChangeLog 10 Nov 2005 23:29:33 -0000 1.3118.4.78
@@ -2,6 +2,23 @@
Merged fix from TOT to Safari-2-0-branch
+ 2005-07-12 Geoffrey Garen <ggaren at apple.com>
+
+ Patch by Mitz Pettel
+ Added layout test for
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=3435
+ Parentheses are backwards in Hebrew text (no bidi mirroring?)
+
+ Test is manual because results only reflect visually -
+ the layout is the same either way.
+
+ Test cases added:
+ * manual-tests/bidi-parens.html: Added.
+
+2005-11-10 Timothy Hatcher <timothy at apple.com>
+
+ Merged fix from TOT to Safari-2-0-branch
+
2005-09-16 John Sullivan <sullivan at apple.com>
Reviewed by Tim Omernick
No revision
No revision
1.34.18.1 +1 -0 WebKit/WebCoreSupport.subproj/WebTextRenderer.h
Index: WebTextRenderer.h
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.h,v
retrieving revision 1.34
retrieving revision 1.34.18.1
diff -u -r1.34 -r1.34.18.1
--- WebTextRenderer.h 8 Feb 2004 22:40:10 -0000 1.34
+++ WebTextRenderer.h 10 Nov 2005 23:29:38 -0000 1.34.18.1
@@ -47,6 +47,7 @@
NSFont *smallCapsFont;
ATSUStyle _ATSUSstyle;
BOOL ATSUStyleInitialized;
+ BOOL ATSUMirrors;
}
+ (BOOL)shouldBufferTextDrawing;
1.165.8.9 +39 -3 WebKit/WebCoreSupport.subproj/WebTextRenderer.m
Index: WebTextRenderer.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.m,v
retrieving revision 1.165.8.8
retrieving revision 1.165.8.9
diff -u -r1.165.8.8 -r1.165.8.9
--- WebTextRenderer.m 26 Aug 2005 00:04:12 -0000 1.165.8.8
+++ WebTextRenderer.m 10 Nov 2005 23:29:38 -0000 1.165.8.9
@@ -1463,6 +1463,7 @@
if (!ATSUStyleInitialized){
OSStatus status;
+ ByteCount propTableSize;
status = ATSUCreateStyle(&_ATSUSstyle);
if(status != noErr)
@@ -1483,6 +1484,13 @@
status = ATSUSetAttributes (_ATSUSstyle, 3, styleTags, styleSizes, styleValues);
if(status != noErr)
FATAL_ALWAYS ("ATSUSetAttributes failed (%d)", status);
+ status = ATSFontGetTable(fontID, 'prop', 0, 0, 0, &propTableSize);
+ if (status == noErr) // naively assume that if a 'prop' table exists then it contains mirroring info
+ ATSUMirrors = YES;
+ else if (status == kATSInvalidFontTableAccess)
+ ATSUMirrors = NO;
+ else
+ FATAL_ALWAYS ("ATSFontGetTable failed (%d)", status);
ATSUStyleInitialized = YES;
}
@@ -1612,6 +1620,25 @@
return swappedRun;
}
+// Be sure to free the run.characters allocated by this function.
+static WebCoreTextRun applyMirroringToRun(const WebCoreTextRun *run)
+{
+ WebCoreTextRun swappedRun;
+ unsigned int i;
+
+ UniChar *swappedCharacters = (UniChar *)malloc(sizeof(UniChar)*(run->length));
+ for (i=0; i < run->length; i++) {
+ // will choke on surrogate pairs?
+ swappedCharacters[i] = u_charMirror(run->characters[i]);
+ }
+ swappedRun.from = run->from;
+ swappedRun.to = run->to;
+ swappedRun.length = run->length;
+ swappedRun.characters = swappedCharacters;
+
+ return swappedRun;
+}
+
- (void)_ATSU_drawHighlightForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style geometry:(const WebCoreTextGeometry *)geometry
{
// The only Cocoa calls made here are to NSColor and NSBezierPath,
@@ -1630,6 +1657,9 @@
if (style->visuallyOrdered) {
swappedRun = reverseCharactersInRun(run);
aRun = &swappedRun;
+ } else if (style->rtl && !ATSUMirrors) {
+ swappedRun = applyMirroringToRun(run);
+ aRun = &swappedRun;
}
from = aRun->from;
@@ -1682,7 +1712,7 @@
ATSUDisposeTextLayout (layout); // Ignore the error. Nothing we can do anyway.
- if (style->visuallyOrdered)
+ if (style->visuallyOrdered || (style->rtl && !ATSUMirrors))
free ((void *)swappedRun.characters);
}
@@ -1703,6 +1733,9 @@
if (style->visuallyOrdered) {
swappedRun = reverseCharactersInRun(run);
aRun = &swappedRun;
+ } else if (style->rtl && !ATSUMirrors) {
+ swappedRun = applyMirroringToRun(run);
+ aRun = &swappedRun;
}
from = aRun->from;
@@ -1743,7 +1776,7 @@
ATSUDisposeTextLayout (layout); // Ignore the error. Nothing we can do anyway.
- if (style->visuallyOrdered)
+ if (style->visuallyOrdered || (style->rtl && !ATSUMirrors))
free ((void *)swappedRun.characters);
}
@@ -1765,6 +1798,9 @@
if (style->visuallyOrdered) {
swappedRun = reverseCharactersInRun(run);
aRun = &swappedRun;
+ } else if (style->rtl && !ATSUMirrors) {
+ swappedRun = applyMirroringToRun(run);
+ aRun = &swappedRun;
}
layout = [self _createATSUTextLayoutForRun:aRun style:style];
@@ -1783,7 +1819,7 @@
ATSUDisposeTextLayout(layout);
- if (style->visuallyOrdered) {
+ if (style->visuallyOrdered || (style->rtl && !ATSUMirrors)) {
free ((void *)swappedRun.characters);
}
More information about the webkit-changes
mailing list