Changeset 86739 in webkit


Ignore:
Timestamp:
May 18, 2011 12:19:48 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

-2011-05-17 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Dirk Schulze.

Refactor TextRun creation
https://bugs.webkit.org/show_bug.cgi?id=60255

Add constructTextRun() methods to RenderBlock/InlineTextBox and use it in various places in rendering/.
The long-term goal is to remove the ugly eight parameters catch-it-all TextRun constructor, and
replace it with explicit setters/getters. To avoid expanding dozens of callsites, when removing
the catch-it-all constructor, these helper functions are introduced, which hide the details of
creating a TextRun.

Furthermore it will be used to remove the platform layering violation, that TextRun stores
RenderObject pointers for the sake of SVG Fonts support, see bug 60254.

No change in functionaliy, no new tests.

  • 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): (WebCore::InlineTextBox::constructTextRun):
  • rendering/InlineTextBox.h:
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::constructTextRunAllowTrailingExpansion):
  • rendering/RenderBlock.h:
  • rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
  • rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::paintObject): (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
  • rendering/RenderImage.cpp: (WebCore::RenderImage::setImageSizeForAltText): (WebCore::RenderImage::paintReplaced):
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::updateFromElement):
  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::getAvgCharWidth):
Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86737 r86739  
     12011-05-17  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Dirk Schulze.
     4
     5        Refactor TextRun creation
     6        https://bugs.webkit.org/show_bug.cgi?id=60255
     7
     8        Add constructTextRun() methods to RenderBlock/InlineTextBox and use it in various places in rendering/.
     9        The long-term goal is to remove the ugly eight parameters catch-it-all TextRun constructor, and
     10        replace it with explicit setters/getters. To avoid expanding dozens of callsites, when removing
     11        the catch-it-all constructor, these helper functions are introduced, which hide the details of
     12        creating a TextRun.
     13
     14        Furthermore it will be used to remove the platform layering violation, that TextRun stores
     15        RenderObject pointers for the sake of SVG Fonts support, see bug 60254.
     16
     17        No change in functionaliy, no new tests.
     18
     19        * rendering/EllipsisBox.cpp:
     20        (WebCore::EllipsisBox::paint):
     21        (WebCore::EllipsisBox::selectionRect):
     22        (WebCore::EllipsisBox::paintSelection):
     23        * rendering/InlineTextBox.cpp:
     24        (WebCore::InlineTextBox::selectionRect):
     25        (WebCore::InlineTextBox::paint):
     26        (WebCore::InlineTextBox::paintSelection):
     27        (WebCore::InlineTextBox::paintCompositionBackground):
     28        (WebCore::InlineTextBox::paintSpellingOrGrammarMarker):
     29        (WebCore::InlineTextBox::paintTextMatchMarker):
     30        (WebCore::InlineTextBox::computeRectForReplacementMarker):
     31        (WebCore::InlineTextBox::offsetForPosition):
     32        (WebCore::InlineTextBox::positionForOffset):
     33        (WebCore::InlineTextBox::constructTextRun):
     34        * rendering/InlineTextBox.h:
     35        * rendering/RenderBlock.cpp:
     36        (WebCore::RenderBlock::constructTextRunAllowTrailingExpansion):
     37        * rendering/RenderBlock.h:
     38        * rendering/RenderEmbeddedObject.cpp:
     39        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
     40        * rendering/RenderFileUploadControl.cpp:
     41        (WebCore::RenderFileUploadControl::paintObject):
     42        (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
     43        * rendering/RenderImage.cpp:
     44        (WebCore::RenderImage::setImageSizeForAltText):
     45        (WebCore::RenderImage::paintReplaced):
     46        * rendering/RenderListBox.cpp:
     47        (WebCore::RenderListBox::updateFromElement):
     48        * rendering/RenderTextControl.cpp:
     49        (WebCore::RenderTextControl::getAvgCharWidth):
     50
    1512011-05-17  Jeremy Noble  <jer.noble@apple.com>
    252
  • trunk/Source/WebCore/rendering/EllipsisBox.cpp

    r86705 r86739  
    2525#include "HitTestResult.h"
    2626#include "PaintInfo.h"
     27#include "RenderBlock.h"
    2728#include "RootInlineBox.h"
    2829#include "TextRun.h"
     
    5354    }
    5455
    55     const String& str = m_str;
    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()));
     56    // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
     57    context->drawText(style->font(), RenderBlock::constructTextRunAllowTrailingExpansion(m_str, style), IntPoint(m_x + tx, m_y + ty + style->fontMetrics().ascent()));
    5858
    5959    // Restore the regular fill color.
     
    7676    RenderStyle* style = m_renderer->style(m_firstLine);
    7777    const Font& f = style->font();
    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()),
    80             IntPoint(m_x + tx, m_y + ty + root()->selectionTop()), root()->selectionHeight()));
     78    // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
     79    return enclosingIntRect(f.selectionRectForText(RenderBlock::constructTextRunAllowTrailingExpansion(m_str, style), IntPoint(m_x + tx, m_y + ty + root()->selectionTop()), root()->selectionHeight()));
    8180}
    8281
     
    9796    int h = root()->selectionHeight();
    9897    context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h));
    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()),
    101         IntPoint(m_x + tx, m_y + ty + y), h, c, style->colorSpace());
     98    // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
     99    context->drawHighlightForText(font, RenderBlock::constructTextRunAllowTrailingExpansion(m_str, style), IntPoint(m_x + tx, m_y + ty + y), h, c, style->colorSpace());
    102100}
    103101
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r86705 r86739  
    4343#include "RenderTheme.h"
    4444#include "Text.h"
     45#include "TextRun.h"
    4546#include "break_lines.h"
    4647#include <wtf/AlwaysInline.h>
     
    160161}
    161162
    162 typedef Vector<UChar, 256> BufferForAppendingHyphen;
    163 
    164163static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, RenderStyle* style, const UChar*& characters, int& length)
    165164{
     
    186185    const Font& f = styleToUse->font();
    187186
    188     const UChar* characters = textObj->text()->characters() + m_start;
    189     int len = m_len;
    190187    BufferForAppendingHyphen charactersWithHyphen;
    191     if (ePos == len && hasHyphen()) {
    192         adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, len);
    193         ePos = len;
    194     }
    195 
    196     IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride),
    197                                                         FloatPoint(logicalLeft(), selTop), selHeight, sPos, ePos));
     188    bool respectHyphen = ePos == m_len && hasHyphen();
     189    TextRun textRun = constructTextRun(styleToUse, respectHyphen ? &charactersWithHyphen : 0);
     190    if (respectHyphen)
     191        endPos = textRun.length();
     192
     193    IntRect r = enclosingIntRect(f.selectionRectForText(textRun, FloatPoint(logicalLeft(), selTop), selHeight, sPos, ePos));
    198194
    199195    int logicalWidth = r.width();
     
    648644
    649645    BufferForAppendingHyphen charactersWithHyphen;
     646    TextRun textRun = constructTextRun(styleToUse, characters, length, hasHyphen() ? &charactersWithHyphen : 0);
    650647    if (hasHyphen())
    651         adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, length);
    652 
    653     TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || styleToUse->visuallyOrdered());
     648        length = textRun.length();
    654649
    655650    int sPos = 0;
     
    813808
    814809    BufferForAppendingHyphen charactersWithHyphen;
    815     if (ePos == length && hasHyphen()) {
    816         adjustCharactersAndLengthForHyphen(charactersWithHyphen, style, characters, length);
    817         ePos = length;
    818     }
     810    bool respectHyphen = ePos == length && hasHyphen();
     811    TextRun textRun = constructTextRun(style, characters, length, respectHyphen ? &charactersWithHyphen : 0);
     812    if (respectHyphen)
     813        ePos = textRun.length();
    819814
    820815    int deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
     
    828823    context->clip(clipRect);
    829824
    830     context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(),
    831                                   direction(), m_dirOverride || style->visuallyOrdered()),
    832                                   localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
     825    context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
    833826}
    834827
     
    851844    int selHeight = selectionHeight();
    852845    FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY);
    853     context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(),
    854                                   direction(), m_dirOverride || style->visuallyOrdered()),
    855                                   localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
     846    context->drawHighlightForText(font, constructTextRun(style), localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
    856847}
    857848
     
    10111002        int selHeight = selectionHeight();
    10121003        FloatPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY);
    1013         TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
    1014        
     1004        TextRun run = constructTextRun(style);
     1005
    10151006        // FIXME: Convert the document markers to float rects.
    10161007        IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, selHeight, startPosition, endPosition));
     
    10561047    int sPos = max(marker.startOffset - m_start, (unsigned)0);
    10571048    int ePos = min(marker.endOffset - m_start, (unsigned)m_len);   
    1058     TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
    1059    
     1049    TextRun run = constructTextRun(style);
     1050
    10601051    // Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates.
    10611052    IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoint(m_x, selectionTop()), selHeight, sPos, ePos));
     
    10831074    int sPos = max(marker.startOffset - m_start, (unsigned)0);
    10841075    int ePos = min(marker.endOffset - m_start, (unsigned)m_len);   
    1085     TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
     1076    TextRun run = constructTextRun(style);
    10861077    IntPoint startPoint = IntPoint(m_x, y);
    10871078   
     
    12431234    RenderStyle* style = text->style(m_firstLine);
    12441235    const Font* f = &style->font();
    1245     int offset = f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len,
    1246         textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered()),
    1247         lineOffset - logicalLeft(), includePartialGlyphs);
     1236    int offset = f->offsetForPosition(constructTextRun(style), lineOffset - logicalLeft(), includePartialGlyphs);
    12481237    if (blockIsInOppositeDirection && (!offset || offset == m_len))
    12491238        return !offset ? m_len : 0;
     
    12601249
    12611250    RenderText* text = toRenderText(renderer());
    1262     const Font& f = text->style(m_firstLine)->font();
     1251    RenderStyle* styleToUse = text->style(m_firstLine);
     1252    ASSERT(styleToUse);
     1253    const Font& f = styleToUse->font();
    12631254    int from = !isLeftToRightDirection() ? offset - m_start : 0;
    12641255    int to = !isLeftToRightDirection() ? m_len : offset - m_start;
    12651256    // FIXME: Do we need to add rightBearing here?
    1266     return f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride),
    1267                                   IntPoint(logicalLeft(), 0), 0, from, to).maxX();
     1257    return f.selectionRectForText(constructTextRun(styleToUse), IntPoint(logicalLeft(), 0), 0, from, to).maxX();
    12681258}
    12691259
     
    12901280    // Offsets at the end are "in" for normal boxes (but the caller has to check affinity).
    12911281    return true;
     1282}
     1283
     1284TextRun InlineTextBox::constructTextRun(RenderStyle* style, BufferForAppendingHyphen* charactersWithHyphen) const
     1285{
     1286    ASSERT(style);
     1287
     1288    RenderText* textRenderer = this->textRenderer();
     1289    ASSERT(textRenderer);
     1290    ASSERT(textRenderer->characters());
     1291
     1292    return constructTextRun(style, textRenderer->characters() + start(), len(), charactersWithHyphen);
     1293}
     1294
     1295TextRun InlineTextBox::constructTextRun(RenderStyle* style, const UChar* characters, int length, BufferForAppendingHyphen* charactersWithHyphen) const
     1296{
     1297    ASSERT(style);
     1298
     1299    RenderText* textRenderer = this->textRenderer();
     1300    ASSERT(textRenderer);
     1301
     1302    if (charactersWithHyphen)
     1303        adjustCharactersAndLengthForHyphen(*charactersWithHyphen, style, characters, length);
     1304
     1305    // FIXME: Remove TextRuns all-in-one-constructor and use explicit setters here.
     1306    return TextRun(characters, length, textRenderer->allowTabs(), textPos(), expansion(), expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
    12921307}
    12931308
  • trunk/Source/WebCore/rendering/InlineTextBox.h

    r86705 r86739  
    3535const unsigned short cNoTruncation = USHRT_MAX;
    3636const unsigned short cFullTruncation = USHRT_MAX - 1;
     37typedef Vector<UChar, 256> BufferForAppendingHyphen;
    3738
    3839// Helper functions shared by InlineTextBox / SVGRootInlineBox
     
    9899    int selectionBottom();
    99100    int selectionHeight();
     101
     102    TextRun constructTextRun(RenderStyle*, BufferForAppendingHyphen* = 0) const;
     103    TextRun constructTextRun(RenderStyle*, const UChar*, int length, BufferForAppendingHyphen* = 0) const;
    100104
    101105public:
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r86705 r86739  
    63176317}
    63186318
     6319TextRun RenderBlock::constructTextRunAllowTrailingExpansion(const UChar* characters, int length, RenderStyle* style, TextRunFlags flags)
     6320{
     6321    ASSERT(style);
     6322
     6323    TextDirection textDirection = LTR;
     6324    bool directionalOverride = style->visuallyOrdered();
     6325    if (flags != DefaultTextRunFlags) {
     6326        if (flags & RespectDirection)
     6327            textDirection = style->direction();
     6328        if (flags & RespectDirectionOverride)
     6329            directionalOverride |= style->unicodeBidi() == Override;
     6330    }
     6331
     6332    // FIXME: Remove TextRuns all-in-one-constructor and use explicit setters here.
     6333    return TextRun(characters, length, false, 0, 0, TextRun::AllowTrailingExpansion, textDirection, directionalOverride);
     6334}
     6335
     6336TextRun RenderBlock::constructTextRunAllowTrailingExpansion(const String& string, RenderStyle* style, TextRunFlags flags)
     6337{
     6338    return constructTextRunAllowTrailingExpansion(string.characters(), string.length(), style, flags);
     6339}
    63196340
    63206341#ifndef NDEBUG
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r86705 r86739  
    5656enum CaretType { CursorCaret, DragCaret };
    5757
     58enum TextRunFlag {
     59    DefaultTextRunFlags = 0,
     60    RespectDirection = 1 << 0,
     61    RespectDirectionOverride = 1 << 1
     62};
     63
     64typedef unsigned TextRunFlags;
     65
    5866class RenderBlock : public RenderBox {
    5967public:
     
    161169   
    162170    static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&);
     171
     172    static TextRun constructTextRunAllowTrailingExpansion(const String&, RenderStyle*, TextRunFlags = DefaultTextRunFlags);
     173    static TextRun constructTextRunAllowTrailingExpansion(const UChar*, int length, RenderStyle*, TextRunFlags = DefaultTextRunFlags);
    163174
    164175    ColumnInfo* columnInfo() const;
  • trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp

    r84504 r86739  
    198198    font.update(0);
    199199   
    200     run = TextRun(m_replacementText.characters(), m_replacementText.length());
     200    run = TextRun(m_replacementText);
    201201    textWidth = font.width(run);
    202202   
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r85143 r86739  
    222222    if (paintInfo.phase == PaintPhaseForeground) {
    223223        const String& displayedFilename = fileTextValue();
    224         unsigned length = displayedFilename.length();
    225         const UChar* string = displayedFilename.characters();
    226         TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, style()->direction(), style()->unicodeBidi() == Override);
    227        
     224        TextRun textRun = constructTextRunAllowTrailingExpansion(displayedFilename, style(), RespectDirection | RespectDirectionOverride);
     225
    228226        // Determine where the filename should be placed
    229227        int contentLeft = tx + borderLeft() + paddingLeft();
     
    271269    m_maxPreferredLogicalWidth = 0;
    272270
    273     if (style()->width().isFixed() && style()->width().value() > 0)
    274         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
     271    RenderStyle* style = this->style();
     272    ASSERT(style);
     273
     274    if (style->width().isFixed() && style->width().value() > 0)
     275        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style->width().value());
    275276    else {
    276277        // Figure out how big the filename space needs to be for a given number of characters
    277278        // (using "0" as the nominal character).
    278279        const UChar ch = '0';
    279         float charWidth = style()->font().width(TextRun(&ch, 1, false, 0, 0, TextRun::AllowTrailingExpansion));
     280        float charWidth = style->font().width(constructTextRunAllowTrailingExpansion(String(&ch, 1), style));
    280281        m_maxPreferredLogicalWidth = (int)ceilf(charWidth * defaultWidthNumChars);
    281282    }
    282283
    283     if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
    284         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
    285         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
    286     } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
     284    if (style->minWidth().isFixed() && style->minWidth().value() > 0) {
     285        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style->minWidth().value()));
     286        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style->minWidth().value()));
     287    } else if (style->width().isPercent() || (style->width().isAuto() && style->height().isPercent()))
    287288        m_minPreferredLogicalWidth = 0;
    288289    else
    289290        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
    290291
    291     if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
    292         m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
    293         m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
     292    if (style->maxWidth().isFixed() && style->maxWidth().value() != undefinedLength) {
     293        m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style->maxWidth().value()));
     294        m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style->maxWidth().value()));
    294295    }
    295296
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r86705 r86739  
    105105    if (!m_altText.isEmpty()) {
    106106        const Font& font = style()->font();
    107         IntSize textSize(min(font.width(TextRun(m_altText.characters(), m_altText.length())), maxAltTextWidth), min(font.fontMetrics().height(), maxAltTextHeight));
     107        IntSize textSize(min(font.width(TextRun(m_altText)), maxAltTextWidth), min(font.fontMetrics().height(), maxAltTextHeight));
    108108        imageSize = imageSize.expandedTo(textSize);
    109109    }
     
    287287                // Only draw the alt text if it'll fit within the content box,
    288288                // and only if it fits above the error image.
    289                 TextRun textRun(text.characters(), text.length());
     289                TextRun textRun(text);
    290290                int textWidth = font.width(textRun);
    291291                if (errorPictureDrawn) {
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r86705 r86739  
    121121            if (!text.isEmpty()) {
    122122                // FIXME: Why is this always LTR? Can't text direction affect the width?
    123                 float textWidth = itemFont.width(TextRun(text.impl(), false, 0, 0, TextRun::AllowTrailingExpansion, LTR));
     123                float textWidth = itemFont.width(constructTextRunAllowTrailingExpansion(text, style()));
    124124                width = max(width, textWidth);
    125125            }
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r85864 r86739  
    543543
    544544    const UChar ch = '0';
    545     return style()->font().width(TextRun(&ch, 1, false, 0, 0, TextRun::AllowTrailingExpansion));
     545    return style()->font().width(constructTextRunAllowTrailingExpansion(String(&ch, 1), style()));
    546546}
    547547
Note: See TracChangeset for help on using the changeset viewer.