[webkit-changes] cvs commit: LayoutTests/fast/text atsui-rtl-override-selection-expected.checksum atsui-rtl-override-selection-expected.png atsui-rtl-override-selection-expected.txt atsui-rtl-override-selection.html

Darin darin at opensource.apple.com
Sat Dec 17 10:10:36 PST 2005


darin       05/12/17 10:10:36

  Modified:    .        ChangeLog
               kwq      KWQFontMetrics.h KWQFontMetrics.mm
                        WebCoreTextRenderer.h
               khtml/rendering font.h render_text.cpp
               .        ChangeLog
               WebCoreSupport.subproj WebTextRenderer.m
               .        ChangeLog
  Added:       fast/text atsui-rtl-override-selection-expected.checksum
                        atsui-rtl-override-selection-expected.png
                        atsui-rtl-override-selection-expected.txt
                        atsui-rtl-override-selection.html
  Log:
  LayoutTests:
  
          Reviewed and landed by Darin.
  
          - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5479
            Can't select text with RTL override rendered by ATSUI
  
          * fast/text/atsui-rtl-override-selection-expected.checksum: Added.
          * fast/text/atsui-rtl-override-selection-expected.png: Added.
          * fast/text/atsui-rtl-override-selection-expected.txt: Added.
          * fast/text/atsui-rtl-override-selection.html: Added.
  
  WebCore:
  
          Reviewed and landed by Darin.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5479
            Can't select text with RTL override rendered by ATSUI
  
          * khtml/rendering/font.h: Remove reversed parameter from checkSelectionPoint, replacing
          it with a text direction parameter.
          * khtml/rendering/render_text.cpp: (InlineTextBox::offsetForPosition): Ditto.
          * kwq/KWQFontMetrics.h: Add a directional override parameter to checkSelectionPoint.
          * kwq/KWQFontMetrics.mm: (QFontMetrics::checkSelectionPoint): Pass the directional override
          through to the text renderer. Don't pass the reversed flag redundantly -- use the rtl flag
          in the style instead.
          * kwq/WebCoreTextRenderer.h: Remove reversed parameter from pointToOffset.
  
  WebKit:
  
          Reviewed and landed by Darin.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5479
            Can't select text with RTL override rendered by ATSUI
  
          * WebCoreSupport.subproj/WebTextRenderer.m:
          (overrideLayoutOperation): Update since the layout only includes from -> to now.
          (-[WebTextRenderer pointToOffset:style:position:includePartialGlyphs:]): Remove
          reversed parameter.
          (CG_floatWidthForRun): Add code to handle RTL case.
          (addDirectionalOverride): Put the override around the entire run.
          (ATSU_drawHighlight): Rearrange and reuse ATSU_floatWidthForRun for more of the work.
          Also round.
          (ATSU_pointToOffset): Remove reversed parameter and run swapping.
          (CG_pointToOffset): Remove reversed parameter, using rtl flag in style instead.
  
  Revision  Changes    Path
  1.555     +16 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.554
  retrieving revision 1.555
  diff -u -r1.554 -r1.555
  --- ChangeLog	16 Dec 2005 22:26:07 -0000	1.554
  +++ ChangeLog	17 Dec 2005 18:10:21 -0000	1.555
  @@ -1,3 +1,19 @@
  +2005-12-17  Mitz Pettel  <opendarwin.org at mitzpettel.com>
  +
  +        Reviewed and landed by Darin.
  +
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5479
  +          Can't select text with RTL override rendered by ATSUI
  +
  +        * khtml/rendering/font.h: Remove reversed parameter from checkSelectionPoint, replacing
  +        it with a text direction parameter.
  +        * khtml/rendering/render_text.cpp: (InlineTextBox::offsetForPosition): Ditto.
  +        * kwq/KWQFontMetrics.h: Add a directional override parameter to checkSelectionPoint.
  +        * kwq/KWQFontMetrics.mm: (QFontMetrics::checkSelectionPoint): Pass the directional override
  +        through to the text renderer. Don't pass the reversed flag redundantly -- use the rtl flag
  +        in the style instead.
  +        * kwq/WebCoreTextRenderer.h: Remove reversed parameter from pointToOffset.
  +
   2005-12-16  Eric Seidel  <eseidel at apple.com>
   
           Reviewed by darin.
  
  
  
  1.44      +1 -1      WebCore/kwq/KWQFontMetrics.h
  
  Index: KWQFontMetrics.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQFontMetrics.h,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- KWQFontMetrics.h	2 Dec 2005 03:48:12 -0000	1.43
  +++ KWQFontMetrics.h	17 Dec 2005 18:10:25 -0000	1.44
  @@ -54,7 +54,7 @@
       int width(const QString &, int tabWidth, int xpos, int len=-1) const;
       int width(const QChar *, int len, int tabWidth, int xpos) const;
       float floatWidth(const QChar *, int slen, int pos, int len, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps) const;
  -    int checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const;
  +    int checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool dirOverride, bool includePartialGlyphs) const;
   
       QRect boundingRect(QChar) const;
       QRect boundingRect(const QString &, int tabWidth, int xpos, int len=-1) const;
  
  
  
  1.94      +3 -2      WebCore/kwq/KWQFontMetrics.mm
  
  Index: KWQFontMetrics.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQFontMetrics.mm,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- KWQFontMetrics.mm	2 Dec 2005 03:48:12 -0000	1.93
  +++ KWQFontMetrics.mm	17 Dec 2005 18:10:25 -0000	1.94
  @@ -224,7 +224,7 @@
       return [data->getRenderer() floatWidthForRun:&run style:&style];
   }
   
  -int QFontMetrics::checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const
  +int QFontMetrics::checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool dirOverride, bool includePartialGlyphs) const
   {
       if (!data) {
           ERROR("called checkSelectionPoint on an empty QFontMetrics");
  @@ -246,8 +246,9 @@
       style.tabWidth = tabWidth;
       style.xpos = xpos;
       style.rtl = reversed;
  +    style.directionalOverride = dirOverride;
   
  -    return [data->getRenderer() pointToOffset:&run style:&style position:x reversed:reversed includePartialGlyphs:includePartialGlyphs];
  +    return [data->getRenderer() pointToOffset:&run style:&style position:x includePartialGlyphs:includePartialGlyphs];
   }
   
   QRect QFontMetrics::boundingRect(QChar c) const
  
  
  
  1.38      +1 -1      WebCore/kwq/WebCoreTextRenderer.h
  
  Index: WebCoreTextRenderer.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/WebCoreTextRenderer.h,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- WebCoreTextRenderer.h	20 Oct 2005 06:02:27 -0000	1.37
  +++ WebCoreTextRenderer.h	17 Dec 2005 18:10:25 -0000	1.38
  @@ -100,6 +100,6 @@
   - (int)misspellingLineThickness;
   
   // selection point check
  -- (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed includePartialGlyphs:(BOOL)includePartialGlyphs;
  +- (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x includePartialGlyphs:(BOOL)includePartialGlyphs;
   
   @end
  
  
  
  1.36      +3 -3      WebCore/khtml/rendering/font.h
  
  Index: font.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/font.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- font.h	20 Oct 2005 06:02:24 -0000	1.35
  +++ font.h	17 Dec 2005 18:10:26 -0000	1.36
  @@ -103,7 +103,7 @@
                     QPainter::TextDirection d, bool visuallyOrdered = false, int from = -1, int to = -1, QColor bg = QColor()) const;
       float floatWidth(QChar *str, int slen, int pos, int len, int tabWidth, int xpos) const;
       bool isFixedPitch() const;
  -    int checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, bool reversed, bool includePartialGlyphs) const;
  +    int checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, QPainter::TextDirection d, bool visuallyOrdered, bool includePartialGlyphs) const;
       void drawHighlightForText(QPainter *p, int x, int y, int h, int tabWidth, int xpos, 
           QChar *str, int slen, int pos, int len, int width,
           QPainter::TextDirection d, bool visuallyOrdered = false, int from = -1, int to = -1, QColor bg = QColor()) const;
  @@ -127,9 +127,9 @@
       return fm.floatWidth(chs, slen, pos, len, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps);
   }
   
  -inline int Font::checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, bool reversed, bool includePartialGlyphs) const
  +inline int Font::checkSelectionPoint(QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, QPainter::TextDirection d, bool visuallyOrdered, bool includePartialGlyphs) const
   {
  -    return fm.checkSelectionPoint(s, slen, pos, len, toAdd, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps, x, reversed, includePartialGlyphs);
  +    return fm.checkSelectionPoint(s + pos, slen - pos, 0, len, toAdd, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps, x, d == QPainter::RTL, visuallyOrdered, includePartialGlyphs);
   }
   
   inline int Font::width(QChar *chs, int slen, int pos, int len, int tabWidth, int xpos) const
  
  
  
  1.212     +3 -2      WebCore/khtml/rendering/render_text.cpp
  
  Index: render_text.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_text.cpp,v
  retrieving revision 1.211
  retrieving revision 1.212
  diff -u -r1.211 -r1.212
  --- render_text.cpp	16 Dec 2005 16:18:44 -0000	1.211
  +++ render_text.cpp	17 Dec 2005 18:10:26 -0000	1.212
  @@ -747,8 +747,9 @@
   int InlineTextBox::offsetForPosition(int _x, bool includePartialGlyphs) const
   {
       RenderText* text = static_cast<RenderText*>(m_object);
  -    const Font* f = text->htmlFont(m_firstLine);
  -    return f->checkSelectionPoint(text->str->s, text->str->l, m_start, m_len, m_toAdd, text->tabWidth(), textPos(), _x - m_x, m_reversed, includePartialGlyphs);
  +    RenderStyle *style = text->style(m_firstLine);
  +    const Font* f = &style->htmlFont();
  +    return f->checkSelectionPoint(text->str->s, text->str->l, m_start, m_len, m_toAdd, text->tabWidth(), textPos(), _x - m_x, m_reversed ? QPainter::RTL : QPainter::LTR, m_dirOverride || style->visuallyOrdered(), includePartialGlyphs);
   }
   
   int InlineTextBox::positionForOffset(int offset) const
  
  
  
  1.3407    +18 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3406
  retrieving revision 1.3407
  diff -u -r1.3406 -r1.3407
  --- ChangeLog	16 Dec 2005 16:51:03 -0000	1.3406
  +++ ChangeLog	17 Dec 2005 18:10:27 -0000	1.3407
  @@ -1,3 +1,21 @@
  +2005-12-17  Mitz Pettel  <opendarwin.org at mitzpettel.com>
  +
  +        Reviewed and landed by Darin.
  +
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5479
  +          Can't select text with RTL override rendered by ATSUI
  +
  +        * WebCoreSupport.subproj/WebTextRenderer.m:
  +        (overrideLayoutOperation): Update since the layout only includes from -> to now.
  +        (-[WebTextRenderer pointToOffset:style:position:includePartialGlyphs:]): Remove
  +        reversed parameter.
  +        (CG_floatWidthForRun): Add code to handle RTL case.
  +        (addDirectionalOverride): Put the override around the entire run.
  +        (ATSU_drawHighlight): Rearrange and reuse ATSU_floatWidthForRun for more of the work.
  +        Also round.
  +        (ATSU_pointToOffset): Remove reversed parameter and run swapping.
  +        (CG_pointToOffset): Remove reversed parameter, using rtl flag in style instead.
  +
   2005-12-16  Evan Gross  <evan at rainmakerinc.com>
   
           Reviewed and landed by Darin.
  
  
  
  1.203     +63 -75    WebKit/WebCoreSupport.subproj/WebTextRenderer.m
  
  Index: WebTextRenderer.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.m,v
  retrieving revision 1.202
  retrieving revision 1.203
  diff -u -r1.202 -r1.203
  --- WebTextRenderer.m	8 Dec 2005 07:41:21 -0000	1.202
  +++ WebTextRenderer.m	17 Dec 2005 18:10:34 -0000	1.203
  @@ -135,9 +135,9 @@
   
   // Selection point detection in runs.
   static int CG_pointToOffset(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *,
  -    int x, bool reversed, bool includePartialGlyphs);
  +    int x, bool includePartialGlyphs);
   static int ATSU_pointToOffset(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *,
  -    int x, bool reversed, bool includePartialGlyphs);
  +    int x, bool includePartialGlyphs);
   
   // Drawing highlight.
   static void CG_drawHighlight(WebTextRenderer *, const WebCoreTextRun *, const WebCoreTextStyle *, const WebCoreTextGeometry *);
  @@ -234,7 +234,7 @@
           Fixed lastNativePos = 0;
           float lastAdjustedPos = 0;
           const WebCoreTextRun *run = params->run;
  -        const UniChar *characters = run->characters;
  +        const UniChar *characters = run->characters + run->from;
           WebTextRenderer *renderer = params->renderer;
           UniChar ch, nextCh;
           nextCh = *(UniChar *)(((char *)characters)+layoutRecords[0].originalOffset);
  @@ -261,7 +261,7 @@
               if (isRoundingHackCharacter(nextCh))
                   if (!isLastChar
                           || style->applyRunRounding
  -                        || (run->to < (int)run->length && isRoundingHackCharacter(characters[run->to])))
  +                        || (run->to < (int)run->length && isRoundingHackCharacter(characters[run->to - run->from])))
                       lastAdjustedPos = ceilf(lastAdjustedPos);
               layoutRecords[i].realPos = FloatToFixed(lastAdjustedPos);
           }
  @@ -579,11 +579,11 @@
       CGContextRestoreGState(context);
   }
   
  -- (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed includePartialGlyphs:(BOOL)includePartialGlyphs
  +- (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x includePartialGlyphs:(BOOL)includePartialGlyphs
   {
       if (shouldUseATSU(run))
  -        return ATSU_pointToOffset(self, run, style, x, reversed, includePartialGlyphs);
  -    return CG_pointToOffset(self, run, style, x, reversed, includePartialGlyphs);
  +        return ATSU_pointToOffset(self, run, style, x, includePartialGlyphs);
  +    return CG_pointToOffset(self, run, style, x, includePartialGlyphs);
   }
   
   + (void)setAlwaysUseATSU:(bool)f
  @@ -955,13 +955,29 @@
   static float CG_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, WebTextRenderer **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult)
   {
       WidthIterator it;
  -    initializeWidthIterator(&it, renderer, run, style);
  +    WebCoreTextRun completeRun;
  +    const WebCoreTextRun *aRun;
  +    if (!style->rtl)
  +        aRun = run;
  +    else {
  +        completeRun = *run;
  +        completeRun.to = run->length;
  +        aRun = &completeRun;
  +    }
  +    initializeWidthIterator(&it, renderer, aRun, style);
       int numGlyphs = advanceWidthIterator(&it, run->to, widthBuffer, rendererBuffer, glyphBuffer);
  -    if (startPosition)
  -        *startPosition = it.widthToStart;
  +    float runWidth = it.runWidthSoFar;
  +    if (startPosition) {
  +        if (!style->rtl)
  +            *startPosition = it.widthToStart;
  +        else {
  +            advanceWidthIterator(&it, run->length, 0, 0, 0);
  +            *startPosition = it.runWidthSoFar - runWidth;
  +        }
  +    }
       if (numGlyphsResult)
           *numGlyphsResult = numGlyphs;
  -    return it.runWidthSoFar;
  +    return runWidth;
   }
   
   static void updateGlyphMapEntry(WebTextRenderer *renderer, UChar32 c, ATSGlyphRef glyph, WebTextRenderer *substituteRenderer)
  @@ -1275,11 +1291,9 @@
   
       UniChar *charactersWithOverride = malloc(sizeof(UniChar) * (run->length + 2));
   
  -    memcpy(&charactersWithOverride[0], &run->characters[0], sizeof(UniChar) * from);
  -    charactersWithOverride[from] = rtl ? RIGHT_TO_LEFT_OVERRIDE : LEFT_TO_RIGHT_OVERRIDE;
  -    memcpy(&charactersWithOverride[from + 1], &run->characters[from], sizeof(UniChar) * (to - from));
  -    charactersWithOverride[to + 1] = POP_DIRECTIONAL_FORMATTING;
  -    memcpy(&charactersWithOverride[to + 2], &run->characters[to], sizeof(UniChar) * (run->length - to));
  +    charactersWithOverride[0] = rtl ? RIGHT_TO_LEFT_OVERRIDE : LEFT_TO_RIGHT_OVERRIDE;
  +    memcpy(&charactersWithOverride[1], &run->characters[0], sizeof(UniChar) * run->length);
  +    charactersWithOverride[run->length + 1] = POP_DIRECTIONAL_FORMATTING;
   
       WebCoreTextRun runWithOverride;
   
  @@ -1313,63 +1327,48 @@
   {
       // The only Cocoa calls made here are to NSColor and NSBezierPath, and they do not raise exceptions.
   
  -    int from, to;
  -    float selectedLeftX;
  -    const WebCoreTextRun *aRun = run;
  -    WebCoreTextRun swappedRun;
  -
       if (style->backgroundColor == nil)
           return;
       
  -    if (style->directionalOverride) {
  -        swappedRun = addDirectionalOverride(run, style->rtl);
  -        aRun = &swappedRun;
  -    } else if (style->rtl && !renderer->ATSUMirrors) {
  -        swappedRun = applyMirroringToRun(run);
  -        aRun = &swappedRun;
  -    }
  -
  -    from = aRun->from;
  -    to = aRun->to;
  +    int from = run->from;
  +    int to = run->to;
       if (from == -1)
           from = 0;
       if (to == -1)
           to = run->length;
  -   
       int runLength = to - from;
       if (runLength <= 0)
           return;
   
  -    WebCoreTextRun completeRun = *aRun;
  -    completeRun.from = 0;
  -    completeRun.to = aRun->length;
  -    ATSULayoutParameters params;
  -    createATSULayoutParameters(&params, renderer, &completeRun, style);
  -    ItemCount count;
  -    ATSLayoutRecord *layoutRecords;
  -    OSStatus status = ATSUDirectGetLayoutDataArrayPtrFromTextLayout(params.layout, 0, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, (void **)&layoutRecords, &count);
  -    if (status != noErr)
  -        FATAL_ALWAYS("ATSUDirectGetLayoutDataArrayPtrFromTextLayout failed(%d)", status);
  -    ItemCount i = 0;
  -    if (!style->rtl)
  -        while (i < count && layoutRecords[i].originalOffset < sizeof(UniChar) * aRun->from)
  -            i++;
  -    else while (i < count && layoutRecords[i].originalOffset >= sizeof(UniChar) * aRun->to)
  -            i++;
  -    ItemCount j = i;
  -    if (!style->rtl)
  -        while (j < count - 1 && layoutRecords[j].originalOffset < sizeof(UniChar) * aRun->to)
  -            j++;
  -    else while (j < count - 1 && layoutRecords[j].originalOffset >= sizeof(UniChar) * aRun->from)
  -            j++;
  +    WebCoreTextRun runWithLead = *run;
  +    runWithLead.from = 0;
  +    WebCoreTextRun *aRun = &runWithLead;
  +    WebCoreTextRun swappedRun;
  +
  +    if (style->directionalOverride) {
  +        swappedRun = addDirectionalOverride(aRun, style->rtl);
  +        aRun = &swappedRun;
  +    } else if (style->rtl && !renderer->ATSUMirrors) {
  +        swappedRun = applyMirroringToRun(aRun);
  +        aRun = &swappedRun;
  +    }
  +
  +   
  +    float selectedLeftX;
  +    float widthWithLead = ATSU_floatWidthForRun(renderer, aRun, style);
       
  -    float beforeWidth = FixedToFloat(layoutRecords[i].realPos);
  -    if ((style->applyWordRounding && isRoundingHackCharacter(run->characters[run->from])) || style->applyRunRounding)
  -        beforeWidth = ceilf(beforeWidth);
  -    float afterWidth = FixedToFloat(layoutRecords[j].realPos);
  -    float backgroundWidth = afterWidth - beforeWidth;
  +    aRun->to -= runLength;
  +    float leadWidth = ATSU_floatWidthForRun(renderer, aRun, style);
  +    
  +    float backgroundWidth = roundf(widthWithLead - leadWidth);
   
  -    selectedLeftX = geometry->point.x + beforeWidth;
  +    if (!style->rtl)
  +        selectedLeftX = roundf(geometry->point.x + leadWidth);
  +    else {
  +        aRun->to += run->length - run->from;
  +        float totalWidth = ATSU_floatWidthForRun(renderer, aRun, style);
  +        selectedLeftX = roundf(geometry->point.x + totalWidth - widthWithLead);
  +    }
       
       [style->backgroundColor set];
   
  @@ -1377,9 +1376,7 @@
           ? geometry->point.y - renderer->ascent : geometry->selectionY;
       float height = geometry->useFontMetricsForSelectionYAndHeight
           ? renderer->lineSpacing : geometry->selectionHeight;
  -    [NSBezierPath fillRect:NSMakeRect(roundf(selectedLeftX), yPos, roundf(backgroundWidth), height)];
  -
  -    disposeATSULayoutParameters(&params);
  +    [NSBezierPath fillRect:NSMakeRect(selectedLeftX, yPos, backgroundWidth, height)];
   
       if (style->directionalOverride || (style->rtl && !renderer->ATSUMirrors))
           free((void *)swappedRun.characters);
  @@ -1449,20 +1446,11 @@
   }
   
   static int ATSU_pointToOffset(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style,
  -    int x, bool reversed, bool includePartialGlyphs)
  +    int x, bool includePartialGlyphs)
   {
       const WebCoreTextRun *aRun = run;
       WebCoreTextRun swappedRun;
       
  -    if (style->rtl && !style->directionalOverride) {
  -        // Work around ATSUPositionToOffset problem with e.g. Lucida Grande 14
  -        swappedRun = *run;
  -        swappedRun.characters += run->from;
  -        swappedRun.from = 0;
  -        swappedRun.to -= run->from;
  -        swappedRun.length -= run->from;
  -        aRun = &swappedRun;
  -    }
       // Enclose in LRO/RLO - PDF to force ATSU to render visually.
       if (style->directionalOverride) {
           swappedRun = addDirectionalOverride(aRun, style->rtl);
  @@ -1513,7 +1501,7 @@
   }
   
   static int CG_pointToOffset(WebTextRenderer *renderer, const WebCoreTextRun * run, const WebCoreTextStyle *style,
  -    int x, bool reversed, bool includePartialGlyphs)
  +    int x, bool includePartialGlyphs)
   {
       float delta = (float)x;
   
  @@ -1522,7 +1510,7 @@
   
       unsigned offset;
   
  -    if (reversed) {
  +    if (style->rtl) {
           delta -= CG_floatWidthForRun(renderer, run, style, 0, 0, 0, 0, 0);
           while (1) {
               offset = it.currentCharacter;
  
  
  
  1.162     +12 -0     LayoutTests/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/LayoutTests/ChangeLog,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -u -r1.161 -r1.162
  --- ChangeLog	16 Dec 2005 18:34:54 -0000	1.161
  +++ ChangeLog	17 Dec 2005 18:10:35 -0000	1.162
  @@ -1,3 +1,15 @@
  +2005-12-17  Mitz Pettel  <opendarwin.org at mitzpettel.com>
  +
  +        Reviewed and landed by Darin.
  +
  +        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5479
  +          Can't select text with RTL override rendered by ATSUI
  +
  +        * fast/text/atsui-rtl-override-selection-expected.checksum: Added.
  +        * fast/text/atsui-rtl-override-selection-expected.png: Added.
  +        * fast/text/atsui-rtl-override-selection-expected.txt: Added.
  +        * fast/text/atsui-rtl-override-selection.html: Added.
  +
   2005-12-16  Geoffrey Garen  <ggaren at apple.com>
   
           Layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6112
  
  
  
  1.1                  LayoutTests/fast/text/atsui-rtl-override-selection-expected.checksum
  
  Index: atsui-rtl-override-selection-expected.checksum
  ===================================================================
  2e70eb4b4c37088c1c0f8cf1d153de2a
  \ No newline at end of file
  
  
  
  1.1                  LayoutTests/fast/text/atsui-rtl-override-selection-expected.png
  
  	<<Binary file>>
  
  
  1.1                  LayoutTests/fast/text/atsui-rtl-override-selection-expected.txt
  
  Index: atsui-rtl-override-selection-expected.txt
  ===================================================================
  EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text > BDO > BODY > HTML > #document to 9 of #text > BDO > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > BDO > BODY > HTML > #document to 9 of #text > BDO > BODY > HTML > #document toDOMRange:range from 9 of #text > BDO > BODY > HTML > #document to 9 of #text > BDO > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > BDO > BODY > HTML > #document to 9 of #text > BDO > BODY > HTML > #document toDOMRange:range from 3 of #text > BDO > BODY > HTML > #document to 9 of #text > BDO > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (0,0) size 800x600
        RenderBlock (anonymous) at (0,0) size 800x18
          RenderInline {BDO} at (0,0) size 85x18
            RenderText {TEXT} at (0,0) size 85x18
              text run at (0,0) width 85 RTL override: "\x{300}muspimeroL"
          RenderText {TEXT} at (0,0) size 0x0
        RenderBlock {HR} at (0,26) size 800x2 [border: (1px inset #000000)]
        RenderBlock (anonymous) at (0,36) size 800x18
          RenderText {TEXT} at (0,0) size 281x18
            text run at (0,0) width 281: "\x{201C}remips\x{201D} should be highlighted in the above."
          RenderText {TEXT} at (0,0) size 0x0
          RenderText {TEXT} at (0,0) size 0x0
  selection start: position 3 of child 0 {TEXT} of child 2 {BDO} of child 1 {BODY} of child 0 {HTML} of document
  selection end:   position 9 of child 0 {TEXT} of child 2 {BDO} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.1                  LayoutTests/fast/text/atsui-rtl-override-selection.html
  
  Index: atsui-rtl-override-selection.html
  ===================================================================
  <html>
  <head>
  <title>Selection in text with RTL override in ATSUI</title>
  <script type="text/javascript">
  function step7()
  {
      eventSender.mouseUp();
      layoutTestController.notifyDone();
  }
  
  function step6()
  {
      eventSender.mouseMoveTo(60, 10);
      window.setTimeout(step7, 1);
  }
  
  function step5()
  {
      eventSender.mouseMoveTo(15, 10);
      window.setTimeout(step6, 1);
  }
  
  function step4()
  {
      eventSender.mouseDown();
      window.setTimeout(step5, 1);
  }
  
  function step3()
  {
      eventSender.mouseMoveTo(14, 10);
      window.setTimeout(step4, 1000);
  }
  
  step3();
  layoutTestController.waitUntilDone();
  </script>
  </head>
  <body style="margin: 0; padding: 0;"">
  <!-- The &#x0300; forces ATSUI rendering -->
  <bdo dir="rtl">&#x0300;muspimeroL</bdo>
  <hr>
  &ldquo;remips&rdquo; should be highlighted in the above.
  </body>
  </html>
  
  
  



More information about the webkit-changes mailing list