[webkit-changes] cvs commit: WebKit/WebCoreSupport.subproj WebTextRenderer.h WebTextRenderer.m

Geoffrey ggaren at opensource.apple.com
Tue Jul 12 10:44:11 PDT 2005


ggaren      05/07/12 10:44:10

  Modified:    .        ChangeLog
               .        ChangeLog
               WebCoreSupport.subproj WebTextRenderer.h WebTextRenderer.m
  Added:       manual-tests bidi-parens.html
  Log:
  WebCore:
  
          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.
  
  WebKit:
  
          -rolled in patch by opendarwin.org at mitzpettel.com
          for http://bugzilla.opendarwin.org/show_bug.cgi?id=3435
          Parentheses are backwards in Hebrew text (no bidi mirroring?)
  
          Reviewed by mjs.
  
          Layout test added to WebCore.
  
          * WebCoreSupport.subproj/WebTextRenderer.h:
          * WebCoreSupport.subproj/WebTextRenderer.m:
          (-[WebTextRenderer _initializeATSUStyle]):
          (applyMirroringToRun):
          (-[WebTextRenderer _ATSU_drawHighlightForRun:style:geometry:]):
          (-[WebTextRenderer _ATSU_drawRun:style:geometry:]):
          (-[WebTextRenderer _ATSU_pointToOffset:style:position:reversed:includePartialGlyphs:]):
  
  Revision  Changes    Path
  1.4412    +12 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4411
  retrieving revision 1.4412
  diff -u -r1.4411 -r1.4412
  --- ChangeLog	12 Jul 2005 16:37:22 -0000	1.4411
  +++ ChangeLog	12 Jul 2005 17:44:03 -0000	1.4412
  @@ -1,3 +1,15 @@
  +2005-07-12  Geoffrey Garen  <ggaren at apple.com>
  +
  +        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-07-12  Ken Kocienda  <kocienda at apple.com>
   
           Reviewed by me
  
  
  
  1.1                  WebCore/manual-tests/bidi-parens.html
  
  Index: bidi-parens.html
  ===================================================================
  <html>
  <head>
  <style>
  .console {
  	font-family: Arial, Times New Roman
  }
  </style>
  </head>
  <body>
  <p>This test checks for a regression against <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3435">3435 Parentheses are backwards in Hebrew text (no bidi mirroring?)</a>.</p>
  <p>Success: parentheses encapsulate word.</p>
  <p>Failure: parentheses face away from word.</p>
  <hr>
  <p id="console" dir="rtl">
  (למדינות)
  </p>
  </body>
  </html>
  
  
  1.3222    +18 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3221
  retrieving revision 1.3222
  diff -u -r1.3221 -r1.3222
  --- ChangeLog	12 Jul 2005 16:28:57 -0000	1.3221
  +++ ChangeLog	12 Jul 2005 17:44:07 -0000	1.3222
  @@ -1,3 +1,21 @@
  +2005-07-12  Geoffrey Garen  <ggaren at apple.com>
  +
  +        -rolled in patch by opendarwin.org at mitzpettel.com 
  +        for http://bugzilla.opendarwin.org/show_bug.cgi?id=3435
  +        Parentheses are backwards in Hebrew text (no bidi mirroring?)
  +        
  +        Reviewed by mjs.
  +
  +        Layout test added to WebCore.
  +
  +        * WebCoreSupport.subproj/WebTextRenderer.h:
  +        * WebCoreSupport.subproj/WebTextRenderer.m:
  +        (-[WebTextRenderer _initializeATSUStyle]):
  +        (applyMirroringToRun):
  +        (-[WebTextRenderer _ATSU_drawHighlightForRun:style:geometry:]):
  +        (-[WebTextRenderer _ATSU_drawRun:style:geometry:]):
  +        (-[WebTextRenderer _ATSU_pointToOffset:style:position:reversed:includePartialGlyphs:]):
  +
   2005-07-12  Ken Kocienda  <kocienda at apple.com>
   
           Reviewed by Chris Blumenberg
  
  
  
  1.38      +1 -0      WebKit/WebCoreSupport.subproj/WebTextRenderer.h
  
  Index: WebTextRenderer.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.h,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- WebTextRenderer.h	6 Jun 2005 02:21:19 -0000	1.37
  +++ WebTextRenderer.h	12 Jul 2005 17:44:10 -0000	1.38
  @@ -70,6 +70,7 @@
       NSFont *smallCapsFont;
       ATSUStyle _ATSUSstyle;
       BOOL ATSUStyleInitialized;
  +    BOOL ATSUMirrors;
   }
   
   + (BOOL)shouldBufferTextDrawing;
  
  
  
  1.179     +39 -3     WebKit/WebCoreSupport.subproj/WebTextRenderer.m
  
  Index: WebTextRenderer.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.m,v
  retrieving revision 1.178
  retrieving revision 1.179
  diff -u -r1.178 -r1.179
  --- WebTextRenderer.m	9 Jul 2005 00:48:25 -0000	1.178
  +++ WebTextRenderer.m	12 Jul 2005 17:44:10 -0000	1.179
  @@ -1453,6 +1453,7 @@
   
       if (!ATSUStyleInitialized){
           OSStatus status;
  +        ByteCount propTableSize;
           
           status = ATSUCreateStyle(&_ATSUSstyle);
           if(status != noErr)
  @@ -1473,6 +1474,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;
       }
  @@ -1602,6 +1610,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,
  @@ -1620,6 +1647,9 @@
       if (style->visuallyOrdered) {
           swappedRun = reverseCharactersInRun(run);
           aRun = &swappedRun;
  +    } else if (style->rtl && !ATSUMirrors) {
  +        swappedRun = applyMirroringToRun(run);
  +        aRun = &swappedRun;
       }
   
       from = aRun->from;
  @@ -1672,7 +1702,7 @@
   
       ATSUDisposeTextLayout (layout); // Ignore the error.  Nothing we can do anyway.
   
  -    if (style->visuallyOrdered)
  +    if (style->visuallyOrdered || (style->rtl && !ATSUMirrors))
           free ((void *)swappedRun.characters);
   }
   
  @@ -1692,6 +1722,9 @@
       if (style->visuallyOrdered) {
           swappedRun = reverseCharactersInRun(run);
           aRun = &swappedRun;
  +    } else if (style->rtl && !ATSUMirrors) {
  +        swappedRun = applyMirroringToRun(run);
  +        aRun = &swappedRun;
       }
   
       from = aRun->from;
  @@ -1725,7 +1758,7 @@
   
       ATSUDisposeTextLayout (layout); // Ignore the error.  Nothing we can do anyway.
       
  -    if (style->visuallyOrdered)
  +    if (style->visuallyOrdered || (style->rtl && !ATSUMirrors))
           free ((void *)swappedRun.characters);
   }
   
  @@ -1747,6 +1780,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];
  @@ -1763,7 +1799,7 @@
           // Failed to find offset!  Return 0 offset.
       }
          
  -    if (style->visuallyOrdered) {
  +    if (style->visuallyOrdered || (style->rtl && !ATSUMirrors)) {
           free ((void *)swappedRun.characters);
       }
   
  
  
  



More information about the webkit-changes mailing list