Changeset 85143 in webkit


Ignore:
Timestamp:
Apr 27, 2011 8:20:54 PM (13 years ago)
Author:
eric@webkit.org
Message:

2011-04-27 Eric Seidel <eric@webkit.org>

Reviewed by Ryosuke Niwa.

Should have an easy way to construct starting BidiStatus for a paragraph root
https://bugs.webkit.org/show_bug.cgi?id=59226

Two places try to construct BidiStatuses for a paragraph root using copy/paste code.
I've made this a constructor for BidiStatus instead.

As part of this effort I added a direction() accessor for TextRun and got
rid of the old m_rtl bool. This is part of the generic effort in the
Bidi code to replace old bool usage with the superior TextDirection enum
(this generally makes the code cleaner).

As part of this replacement effort I found several places which were
assuming LTR (by passing rtl=false) when they probably want to use
the current text direction. I suspect that LTR vs. RTL may affect
string width in the case of ligatures. It's unclear.

This is almost entirely a mechanical change.

  • html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawTextInternal):
  • platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawBidiText):
  • platform/graphics/TextRun.h: (WebCore::TextRun::TextRun): (WebCore::TextRun::direction): (WebCore::TextRun::rtl): (WebCore::TextRun::ltr): (WebCore::TextRun::setDirection):
  • platform/text/BidiResolver.h: (WebCore::BidiStatus::BidiStatus):
  • rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::paint): (WebCore::EllipsisBox::selectionRect): (WebCore::EllipsisBox::paintSelection):
  • rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::selectionRect): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::paintSelection): (WebCore::InlineTextBox::paintCompositionBackground): (WebCore::InlineTextBox::paintSpellingOrGrammarMarker): (WebCore::InlineTextBox::paintTextMatchMarker): (WebCore::InlineTextBox::computeRectForReplacementMarker): (WebCore::InlineTextBox::offsetForPosition): (WebCore::InlineTextBox::positionForOffset):
  • rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::determineStartPosition):
  • rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::paintObject): (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::updateFromElement): (WebCore::RenderListBox::paintItemForeground):
  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::getAvgCharWidth): (WebCore::RenderTextControl::paintPlaceholder):
  • rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::constructTextRun):
  • rendering/svg/SVGTextMetrics.cpp: (WebCore::constructTextRun):
Location:
trunk/Source
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85142 r85143  
     12011-04-27  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        Should have an easy way to construct starting BidiStatus for a paragraph root
     6        https://bugs.webkit.org/show_bug.cgi?id=59226
     7
     8        Two places try to construct BidiStatuses for a paragraph root using copy/paste code.
     9        I've made this a constructor for BidiStatus instead.
     10
     11        As part of this effort I added a direction() accessor for TextRun and got
     12        rid of the old m_rtl bool.  This is part of the generic effort in the
     13        Bidi code to replace old bool usage with the superior TextDirection enum
     14        (this generally makes the code cleaner).
     15
     16        As part of this replacement effort I found several places which were
     17        assuming LTR (by passing rtl=false) when they probably want to use
     18        the current text direction.  I suspect that LTR vs. RTL may affect
     19        string width in the case of ligatures.  It's unclear.
     20
     21        This is almost entirely a mechanical change.
     22
     23        * html/canvas/CanvasRenderingContext2D.cpp:
     24        (WebCore::CanvasRenderingContext2D::drawTextInternal):
     25        * platform/graphics/GraphicsContext.cpp:
     26        (WebCore::GraphicsContext::drawBidiText):
     27        * platform/graphics/TextRun.h:
     28        (WebCore::TextRun::TextRun):
     29        (WebCore::TextRun::direction):
     30        (WebCore::TextRun::rtl):
     31        (WebCore::TextRun::ltr):
     32        (WebCore::TextRun::setDirection):
     33        * platform/text/BidiResolver.h:
     34        (WebCore::BidiStatus::BidiStatus):
     35        * rendering/EllipsisBox.cpp:
     36        (WebCore::EllipsisBox::paint):
     37        (WebCore::EllipsisBox::selectionRect):
     38        (WebCore::EllipsisBox::paintSelection):
     39        * rendering/InlineTextBox.cpp:
     40        (WebCore::InlineTextBox::selectionRect):
     41        (WebCore::InlineTextBox::paint):
     42        (WebCore::InlineTextBox::paintSelection):
     43        (WebCore::InlineTextBox::paintCompositionBackground):
     44        (WebCore::InlineTextBox::paintSpellingOrGrammarMarker):
     45        (WebCore::InlineTextBox::paintTextMatchMarker):
     46        (WebCore::InlineTextBox::computeRectForReplacementMarker):
     47        (WebCore::InlineTextBox::offsetForPosition):
     48        (WebCore::InlineTextBox::positionForOffset):
     49        * rendering/RenderBlockLineLayout.cpp:
     50        (WebCore::RenderBlock::determineStartPosition):
     51        * rendering/RenderFileUploadControl.cpp:
     52        (WebCore::RenderFileUploadControl::paintObject):
     53        (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
     54        * rendering/RenderListBox.cpp:
     55        (WebCore::RenderListBox::updateFromElement):
     56        (WebCore::RenderListBox::paintItemForeground):
     57        * rendering/RenderTextControl.cpp:
     58        (WebCore::RenderTextControl::getAvgCharWidth):
     59        (WebCore::RenderTextControl::paintPlaceholder):
     60        * rendering/svg/SVGInlineTextBox.cpp:
     61        (WebCore::SVGInlineTextBox::constructTextRun):
     62        * rendering/svg/SVGTextMetrics.cpp:
     63        (WebCore::constructTextRun):
     64
    1652011-04-27  Robert Hogan  <robert@webkit.org>
    266
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r85017 r85143  
    18671867
    18681868    RenderStyle* computedStyle = canvas()->computedStyle();
    1869     bool rtl = computedStyle ? !computedStyle->isLeftToRightDirection() : false;
     1869    TextDirection direction = computedStyle ? computedStyle->direction() : LTR;
     1870    bool isRTL = direction == RTL;
    18701871    bool override = computedStyle ? computedStyle->unicodeBidi() == Override : false;
    18711872
    18721873    unsigned length = text.length();
    18731874    const UChar* string = text.characters();
    1874     TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, rtl, override);
     1875    TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, direction, override);
    18751876
    18761877    // Draw the item text at the correct point.
     
    18941895    }
    18951896
    1896     float width = font.width(TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, rtl, override));
     1897    float width = font.width(TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, direction, override));
    18971898
    18981899    TextAlign align = state().m_textAlign;
    18991900    if (align == StartTextAlign)
    1900          align = rtl ? RightTextAlign : LeftTextAlign;
     1901        align = isRTL ? RightTextAlign : LeftTextAlign;
    19011902    else if (align == EndTextAlign)
    1902         align = rtl ? LeftTextAlign : RightTextAlign;
     1903        align = isRTL ? LeftTextAlign : RightTextAlign;
    19031904
    19041905    switch (align) {
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp

    r84342 r85143  
    964964
    965965    // Prepare the directionality to draw text.
    966     bool rtl = style.textDirection() == RTL;
    967     TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
     966    TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, style.textDirection(), style.hasTextDirectionOverride());
    968967    // If the text is right-to-left, make it right-aligned by adjusting its
    969968    // beginning position.
     
    10031002    }
    10041003
    1005     TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
     1004    TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, style.textDirection(), style.hasTextDirectionOverride());
    10061005    if (rightAligned)
    10071006        textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft());
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r84631 r85143  
    399399        return;
    400400
     401    BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
     402    bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
     403    bidiResolver.setPosition(TextRunIterator(&run, 0));
     404
    401405    // FIXME: This ownership should be reversed. We should pass BidiRunList
    402406    // to BidiResolver in createBidiRunsForLine.
    403     BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
    404407    BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
    405 
    406     WTF::Unicode::Direction paragraphDirection = run.ltr() ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
    407 
    408     bidiResolver.setStatus(BidiStatus(paragraphDirection, paragraphDirection, paragraphDirection, BidiContext::create(run.ltr() ? 0 : 1, paragraphDirection, run.directionalOverride())));
    409 
    410     bidiResolver.setPosition(TextRunIterator(&run, 0));
    411408    bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
    412 
    413409    if (!bidiRuns.runCount())
    414410        return;
     
    417413    BidiCharacterRun* bidiRun = bidiRuns.firstRun();
    418414    while (bidiRun) {
    419 
    420415        TextRun subrun = run;
    421416        subrun.setText(run.data(bidiRun->start()), bidiRun->stop() - bidiRun->start());
    422         subrun.setRTL(bidiRun->level() % 2);
     417        bool isRTL = bidiRun->level() % 2;
     418        subrun.setDirection(isRTL ? RTL : LTR);
    423419        subrun.setDirectionalOverride(bidiRun->dirOverride(false));
    424420
  • trunk/Source/WebCore/platform/graphics/TextRun.h

    r82013 r85143  
    2626
    2727#include "PlatformString.h"
     28#include "TextDirection.h"
    2829
    2930namespace WebCore {
     
    4344    typedef unsigned ExpansionBehavior;
    4445
    45     TextRun(const UChar* c, int len, bool allowTabs = false, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, bool rtl = false, bool directionalOverride = false)
     46    TextRun(const UChar* c, int len, bool allowTabs = false, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false)
    4647        : m_characters(c)
    4748        , m_len(len)
     
    5354#endif
    5455        , m_allowTabs(allowTabs)
    55         , m_rtl(rtl)
     56        , m_direction(direction)
    5657        , m_directionalOverride(directionalOverride)
    5758        , m_disableSpacing(false)
     
    6364    }
    6465
    65     TextRun(const String& s, bool allowTabs = false, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, bool rtl = false, bool directionalOverride = false)
     66    TextRun(const String& s, bool allowTabs = false, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false)
    6667        : m_characters(s.characters())
    6768        , m_len(s.length())
     
    7374#endif
    7475        , m_allowTabs(allowTabs)
    75         , m_rtl(rtl)
     76        , m_direction(direction)
    7677        , m_directionalOverride(directionalOverride)
    7778        , m_disableSpacing(false)
     
    101102    bool allowsLeadingExpansion() const { return m_expansionBehavior & AllowLeadingExpansion; }
    102103    bool allowsTrailingExpansion() const { return m_expansionBehavior & AllowTrailingExpansion; }
    103     bool rtl() const { return m_rtl; }
    104     bool ltr() const { return !m_rtl; }
     104    TextDirection direction() const { return m_direction; }
     105    bool rtl() const { return m_direction == RTL; }
     106    bool ltr() const { return m_direction == LTR; }
    105107    bool directionalOverride() const { return m_directionalOverride; }
    106108    bool spacingDisabled() const { return m_disableSpacing; }
    107109
    108110    void disableSpacing() { m_disableSpacing = true; }
    109     void setRTL(bool b) { m_rtl = b; }
     111    void setDirection(TextDirection direction) { m_direction = direction; }
    110112    void setDirectionalOverride(bool override) { m_directionalOverride = override; }
    111113
     
    132134#endif
    133135    bool m_allowTabs;
    134     bool m_rtl;
    135     bool m_directionalOverride;
     136    TextDirection m_direction;
     137    bool m_directionalOverride; // Was this direction set by an override character.
    136138    bool m_disableSpacing;
    137139
  • trunk/Source/WebCore/platform/text/BidiResolver.h

    r83240 r85143  
    2525#include "BidiContext.h"
    2626#include "BidiRunList.h"
     27#include "TextDirection.h"
    2728#include <wtf/Noncopyable.h>
    2829#include <wtf/PassRefPtr.h>
     
    6162        , last(WTF::Unicode::OtherNeutral)
    6263    {
     64    }
     65
     66    // Creates a BidiStatus representing a new paragraph root with a default direction.
     67    // Uses TextDirection as it only has two possibilities instead of WTF::Unicode::Direction which has 19.
     68    BidiStatus(TextDirection textDirection, bool isOverride)
     69    {
     70        WTF::Unicode::Direction direction = textDirection == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
     71        eor = lastStrong = last = direction;
     72        context = BidiContext::create(textDirection == LTR ? 0 : 1, direction, isOverride);
    6373    }
    6474
  • trunk/Source/WebCore/platform/win/PopupMenuWin.cpp

    r78846 r85143  
    632632        unsigned length = itemText.length();
    633633        const UChar* string = itemText.characters();
    634         TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft);
     634        TextDirection direction = (itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft) ? RTL : LTR;
     635        TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, direction);
    635636
    636637        context.setFillColor(optionTextColor, ColorSpaceDeviceRGB);
  • trunk/Source/WebCore/rendering/EllipsisBox.cpp

    r84504 r85143  
    5454
    5555    const String& str = m_str;
    56     context->drawText(style->font(), TextRun(str.characters(), str.length(), false, 0, 0, TextRun::AllowTrailingExpansion, false, style->visuallyOrdered()), IntPoint(m_x + tx, m_y + ty + style->fontMetrics().ascent()));
     56    // FIXME: Why is this alwasy LTR?
     57    context->drawText(style->font(), TextRun(str.characters(), str.length(), false, 0, 0, TextRun::AllowTrailingExpansion, LTR, style->visuallyOrdered()), IntPoint(m_x + tx, m_y + ty + style->fontMetrics().ascent()));
    5758
    5859    // Restore the regular fill color.
     
    7576    RenderStyle* style = m_renderer->style(m_firstLine);
    7677    const Font& f = style->font();
    77     return enclosingIntRect(f.selectionRectForText(TextRun(m_str.characters(), m_str.length(), false, 0, 0, TextRun::AllowTrailingExpansion, false, style->visuallyOrdered()),
     78    // FIXME: Why is this always LTR?
     79    return enclosingIntRect(f.selectionRectForText(TextRun(m_str.characters(), m_str.length(), false, 0, 0, TextRun::AllowTrailingExpansion, LTR, style->visuallyOrdered()),
    7880            IntPoint(m_x + tx, m_y + ty + root()->selectionTop()), root()->selectionHeight()));
    7981}
     
    9597    int h = root()->selectionHeight();
    9698    context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h));
    97     context->drawHighlightForText(font, TextRun(m_str.characters(), m_str.length(), false, 0, 0, TextRun::AllowTrailingExpansion, false, style->visuallyOrdered()),
     99    // FIXME: Why is this always LTR?
     100    context->drawHighlightForText(font, TextRun(m_str.characters(), m_str.length(), false, 0, 0, TextRun::AllowTrailingExpansion, LTR, style->visuallyOrdered()),
    98101        IntPoint(m_x + tx, m_y + ty + y), h, c, style->colorSpace());
    99102}
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r84956 r85143  
    194194    }
    195195
    196     IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride),
     196    IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride),
    197197                                                        IntPoint(), selHeight, sPos, ePos));
    198198                                                       
     
    651651        adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, length);
    652652
    653     TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride || styleToUse->visuallyOrdered());
     653    TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || styleToUse->visuallyOrdered());
    654654
    655655    int sPos = 0;
     
    820820    context->clip(FloatRect(localOrigin, FloatSize(m_logicalWidth, selHeight)));
    821821    context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(),
    822                                   !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
     822                                  direction(), m_dirOverride || style->visuallyOrdered()),
    823823                                  localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
    824824}
     
    843843    FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY);
    844844    context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(),
    845                                   !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
     845                                  direction(), m_dirOverride || style->visuallyOrdered()),
    846846                                  localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
    847847}
     
    10021002        int selHeight = selectionHeight();
    10031003        FloatPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY);
    1004         TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
     1004        TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
    10051005       
    10061006        // FIXME: Convert the document markers to float rects.
     
    10471047    int sPos = max(marker.startOffset - m_start, (unsigned)0);
    10481048    int ePos = min(marker.endOffset - m_start, (unsigned)m_len);   
    1049     TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
     1049    TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
    10501050   
    10511051    // Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates.
     
    10741074    int sPos = max(marker.startOffset - m_start, (unsigned)0);
    10751075    int ePos = min(marker.endOffset - m_start, (unsigned)m_len);   
    1076     TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
     1076    TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
    10771077    IntPoint startPoint = IntPoint(m_x, y);
    10781078   
     
    12351235    const Font* f = &style->font();
    12361236    int offset = f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len,
    1237         textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
     1237        textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered()),
    12381238        lineOffset - logicalLeft(), includePartialGlyphs);
    12391239    if (blockIsInOppositeDirection && (!offset || offset == m_len))
     
    12551255    int to = !isLeftToRightDirection() ? m_len : offset - m_start;
    12561256    // FIXME: Do we need to add rightBearing here?
    1257     return f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), !isLeftToRightDirection(), m_dirOverride),
     1257    return f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride),
    12581258                                  IntPoint(logicalLeft(), 0), 0, from, to).maxX();
    12591259}
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r84436 r85143  
    12601260    previousLineBrokeCleanly = !last || last->endsWithBreak();
    12611261
    1262     RenderObject* startObj;
    1263     int pos = 0;
    12641262    if (last) {
    12651263        setLogicalHeight(last->blockLogicalHeight());
    1266         startObj = last->lineBreakObj();
    1267         pos = last->lineBreakPos();
     1264        resolver.setPosition(InlineIterator(this, last->lineBreakObj(), last->lineBreakPos()));
    12681265        resolver.setStatus(last->lineBreakBidiStatus());
    12691266    } else {
    1270         bool ltr = style()->isLeftToRightDirection();
    1271         Direction direction = ltr ? LeftToRight : RightToLeft;
    1272         resolver.setLastStrongDir(direction);
    1273         resolver.setLastDir(direction);
    1274         resolver.setEorDir(direction);
    1275         resolver.setContext(BidiContext::create(ltr ? 0 : 1, direction, style()->unicodeBidi() == Override, FromStyleOrDOM));
    1276 
    1277         startObj = bidiFirstSkippingInlines(this, &resolver);
    1278     }
    1279 
    1280     resolver.setPosition(InlineIterator(this, startObj, pos));
    1281 
     1267        resolver.setStatus(BidiStatus(style()->direction(), style()->unicodeBidi() == Override));
     1268        resolver.setPosition(InlineIterator(this, bidiFirstSkippingInlines(this, &resolver), 0));
     1269    }
    12821270    return curr;
    12831271}
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r84504 r85143  
    224224        unsigned length = displayedFilename.length();
    225225        const UChar* string = displayedFilename.characters();
    226         TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, !style()->isLeftToRightDirection(), style()->unicodeBidi() == Override);
     226        TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, style()->direction(), style()->unicodeBidi() == Override);
    227227       
    228228        // Determine where the filename should be placed
     
    277277        // (using "0" as the nominal character).
    278278        const UChar ch = '0';
    279         float charWidth = style()->font().width(TextRun(&ch, 1, false, 0, 0, TextRun::AllowTrailingExpansion, false));
     279        float charWidth = style()->font().width(TextRun(&ch, 1, false, 0, 0, TextRun::AllowTrailingExpansion));
    280280        m_maxPreferredLogicalWidth = (int)ceilf(charWidth * defaultWidthNumChars);
    281281    }
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r84214 r85143  
    116116                itemFont.update(document()->styleSelector()->fontSelector());
    117117            }
    118                
     118
    119119            if (!text.isEmpty()) {
    120                 float textWidth = itemFont.width(TextRun(text.impl(), false, 0, 0, TextRun::AllowTrailingExpansion, false, false));
     120                // FIXME: Why is this always LTR? Can't text direction affect the width?
     121                float textWidth = itemFont.width(TextRun(text.impl(), false, 0, 0, TextRun::AllowTrailingExpansion, LTR));
    121122                width = max(width, textWidth);
    122123            }
     
    390391    unsigned length = itemText.length();
    391392    const UChar* string = itemText.characters();
    392     TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, !itemStyle->isLeftToRightDirection(), itemStyle->unicodeBidi() == Override);
     393    TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->direction(), itemStyle->unicodeBidi() == Override);
    393394    Font itemFont = style()->font();
    394395    IntRect r = itemBoundingBoxRect(tx, ty, listIndex);
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r84504 r85143  
    542542        return roundf(style()->font().primaryFont()->avgCharWidth());
    543543
    544     const UChar ch = '0'; 
    545     return style()->font().width(TextRun(&ch, 1, false, 0, 0, TextRun::AllowTrailingExpansion, false));
     544    const UChar ch = '0';
     545    return style()->font().width(TextRun(&ch, 1, false, 0, 0, TextRun::AllowTrailingExpansion));
    546546}
    547547
     
    637637   
    638638    String placeholderText = static_cast<HTMLTextFormControlElement*>(node())->strippedPlaceholder();
    639     TextRun textRun(placeholderText.characters(), placeholderText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, !placeholderStyle->isLeftToRightDirection(), placeholderStyle->unicodeBidi() == Override);
     639    TextRun textRun(placeholderText.characters(), placeholderText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, placeholderStyle->direction(), placeholderStyle->unicodeBidi() == Override);
    640640   
    641641    RenderBox* textRenderer = innerTextElement() ? innerTextElement()->renderBox() : 0;
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r84504 r85143  
    413413                , 0 /* padding, only relevant for justified text, not relevant for SVG */
    414414                , TextRun::AllowTrailingExpansion
    415                 , direction() == RTL
     415                , direction()
    416416                , m_dirOverride || style->visuallyOrdered() /* directionalOverride */);
    417417
  • trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp

    r81168 r85143  
    8484                , 0 /* padding, only relevant for justified text, not relevant for SVG */
    8585                , TextRun::AllowTrailingExpansion
    86                 , !style->isLeftToRightDirection()
     86                , style->direction()
    8787                , style->unicodeBidi() == Override /* directionalOverride */);
    8888
  • trunk/Source/WebKit/chromium/src/WebTextRun.cpp

    r76743 r85143  
    4040WebTextRun::operator WebCore::TextRun() const
    4141{
    42     return TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, rtl, directionalOverride);
     42    return TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, rtl ? RTL : LTR, directionalOverride);
    4343}
    4444
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp

    r82442 r85143  
    117117        unsigned length = itemText.length();
    118118        const UChar* string = itemText.characters();
    119         TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft);
     119        // FIXME: defaultWritingDirection should return a TextDirection not a Unicode::Direction.
     120        TextDirection direction = itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft ? RTL : LTR;
     121        TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, direction);
    120122
    121123        notSelectedBackingStoreContext->setFillColor(optionTextColor, ColorSpaceDeviceRGB);
Note: See TracChangeset for help on using the changeset viewer.